This is a short video post that I recorded few days back. In this video and I have discussed about available options to use for string manipulation in C#. I have seen many junior to senior developers making the mistakes, knowingly or unknowingly which causes performance issues. I have tried to explain it pictorially.
Hope you’ll enjoy it and do share your feedback.
In this post, we are going to discuss a class SecureString. Although this class is available since .NET 2.0, but I am sure, many of us would not be knowing or using it. Even I was not aware of this fantastic class few weeks ago. This class can be very useful for you if you are more concerned about your application security.
This class belongs to the namespace System.Security . This class should be used to store the data which is confidential. The text assigned to this string is by default encrypted. This data is also removed as soon as it is not required which in-turn reduces the chances of misuse.
This post is extension is my last post on Event Viewer. Please the find the link below.
Working with EventViewer using C#
We’ll be talking about the reading event logs. In my last post I discussed about reading the event logs. But that is very slow because that loads all the event entries in memory and then iterate one by one. Say if we have around one five thousand entries in the log then it will load all the entries in memory and then allows to iterate one by one. It makes the reading of logs very slow. Also at certain point of point we might require to read the event logs on some specific criteria or want to read some specific logs then also we need to load all the events and iterate and find the required entry.
There are several phases of a Application . It does not end with developing the application and deploying it on production servers. Other most important part, any problem surfaces after the deployment, how quickly the problem can be be resolved and according to severity of the issue (if required) a patch can be deployed on production. Apart from this, we also want to get notified on all the issues occurred on production and accordingly analyze and take care in future releases. We can also log other details that could be useful to check the status of Application.
I am pretty sure that most of the guys has never knew this operator and its also very rarely used. Since C# provides this and this is very useful and handy at certain times.
The short from of null-coalescing operator is ??.
It actually takes two operands. So it returns the left hand operand if it is not null else returns right operand. So this is very useful while initializing any variable. let’s see a example
string name = null;
string otherName = "Brij";
string userName = name ?? otherName;
As you can see, here is name is null then userName is assigned to otherName. and it will print Brij.
This is second and last part of the post on Nullable type series. You can view the first part from here
Exploring Nullable types : Part 1
In this series, I will talking certain rules that we need to take care while using Nullable type. I will be taking scenario wise.
object o = a;
long d = (long)c;
It will be compiled successfully but will throw and Invalid Cast Exception. Means, you cannot cast it to any other type except the underlying type which is here int although int type can be hold by long.
In this post, I am going to talk about Nullable types. Actually most of developers know, in c# we have
mainly two types.
– Reference type
– Value type.
But we have more type, that is called Nullable type.
Actually it is a value type but it has feature of both reference and Value type.