C# Operators

Below is a list of commonly used C# operators.

Equality Operators

Operator Description Example
== Is equal to if (x==y)

Sponsored Links

{

}

!= Not equal to if (x != y)

{

}

Relational Operators

Operator Description Example
< Less than if (x < y)
{
}
> Greater than if (x > y)
{
}
<= Less than or equal to if (x <= y)
{
}
>= Greater than or equal to if (x >= y)
{
}

Conditional Operators

Operator Description Example
&& And if ((x > y) && (a > b))
{
}
|| OR if ((x > y) || (a > b))
{
}

Arithmetic Operators

Operator Description Example
= Assignment Operator x = 3;
+ Addition Operator x + y
- Subtraction Operator x - y
* Multiplication Operator x * y
/ Division Operator x / y

Other Operators

Operator Description
++ Increment
-- Decrement

It is useful to learn these, as they are common operators. For a full list visit:

http://msdn.microsoft.com/en-us/library/6a71f45d(v=vs.80).aspx