Operators in C#.Net

C# provides below types of operators.

  1. unary – +, -, *, &
  2. Arithmetic – +, -, ++,–, /, %, =, +=, -=, *=, /=, %=, ==, !=, <=, >=, is, as
  3. Conditional – && ||
  4. Logical –  &, |, <<, >>,  &=, |=, ^=, <<=, >>=
  5. Conditional operator 
    t ? x : y – if test t is true, then evaluate and return x; otherwise, evaluate and return y.
  6. Null Coalescing operator
    x??y returns x if it is not null else returns y
  7. Lambda operator  =>
  8. typeof
  9. sizeof
Some interesting stuff
  1. Have you ever wondered real world applications of bit wise operators? They are primarily used in hardware and embedded programming.
  2. Can you guess the output of below code?
   float a = 10;
double b = a/0;
Trace.WriteLine(b);

You may also like...