Tag: operator
How to Find if the Number is a Power of 2 using Bitwise Operator in C# ?
If you need to find out if the number is a Power of 2 using BitWise Operator in C# , below is a sample code snippet that demonstrates how to do it. How to Find if the Number is a Power of 2 using Bitwise Operator in C# ?
Using or Operator in the Where Clause of LINQ in C#
Below is a sample code snippet demonstrating on how to use “Or” Operator in the Where Clause of Linq in C#? Using or Operator in the Where Clause of LINQ in C#
@ 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 ….
& and && in C#
Below is a sample soucrecode demonstrating the usage of & and && operator in c#.
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#
Postfix and Prefix Operator in C#
Below is a sample code snippet demonstrating the Postfix and Prefix 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.
How to use SQL like Operator in LINQ and C#?
In a SQL Query, one might use the Like Query which can be used along with the % operator to search of contains within the data. How to use SQL like Operator in LINQ and C#? This article will show it with a sample code snippet. How to use SQL like Operator in LINQ and C#? Below is a sample source code demonstrating the usage…