Hi Friends,
here I will explain the Null Coalescing Operator(??) and Ternary Oerator in C#.net this is new features in c#.Net v4.
Null Coalescing Operator (??) - Ternary Operator:A new operator can be used which can be shortcut of ternary operator to check the null value:
Ternary operator (?:):
string empName = (value != null) ? value : string.Empty;
we can write it using null-coalescing operator (??):
string empName = value ?? string.Empty;
here I will explain the Null Coalescing Operator(??) and Ternary Oerator in C#.net this is new features in c#.Net v4.
Null Coalescing Operator (??) - Ternary Operator:A new operator can be used which can be shortcut of ternary operator to check the null value:
Ternary operator (?:):
string empName = (value != null) ? value : string.Empty;
we can write it using null-coalescing operator (??):
string empName = value ?? string.Empty;
No comments:
Post a Comment