The operator '??' is in c#, which is used check the value is null.
Previously, we used to check the null value by the following methods..
if (a!=null) { c=a; } or
c = ((a!=null)?a:0);
we can do the same checking with the new operator ?? like this..
c = a??0;
By this statement the value a will be assigned to c if it is not null else the zero will be assigned.
Previously, we used to check the null value by the following methods..
if (a!=null) { c=a; } or
c = ((a!=null)?a:0);
we can do the same checking with the new operator ?? like this..
c = a??0;
By this statement the value a will be assigned to c if it is not null else the zero will be assigned.
No comments:
Post a Comment