Tag: operator

@ Operator in C#

Although it is not the best practise , If you want use the reserve words and the variable name , you could use the @ prefixed before the variable name . Below is a sample sourcecode that demonstrates the use of @ symbol. static void Main() { int @if = 10; MessageBox.Show(@if.ToString()); }

How to Use the Null Coalescing Operator (??) in C# ?

There are times when you simply want to check if the value is null and perform some steps based on the condition . The Null Coalescing Operator (??) can help you achieve this. How to Use the Null Coalescing Operator (??) in C# ? Below is a sample code that uses Null Coalescing Operator (??) in C# to find if the vaklue is null ….

Using Null Coalescing Operator in C#

Sometimes , you may want to simply the Null checks in your .NET Program without much usage of the if statements . The Null Coalescing Operator can be used in this scenario. Using Null Coalescing Operator in C#

The ? (ternary) Operator in C#

The ? Operator is the ternary operator and takes the following form Expression1? Expression2: Expression3; The Expression1 is an expression which returns Boolean result. Expression2 is considered if the Expression1 is true else Expression2 is taken.