Lecture overview -- Keyboard shortcut: 'u'  Previous page: Why operator overloading? -- Keyboard shortcut: 'p'  Next page: An example of overloaded operators: Interval -- Keyboard shortcut: 'n'  Lecture notes - all slides and notes together  slide -- Keyboard shortcut: 't'  Textbook -- Keyboard shortcut: 'v'  Help page about these notes  Alphabetic index  Course home  Page 29 : 45
Object-oriented Programming in C#
Data Access and Operations
Overloadable operators in C#

Overview of overloadable operators.

A large subset of the C# operators are overloadable

LevelCategoryOperatorsAssociativity
14Primaryx.y      f(x)      a[x]      x++      x--      new      typeof      checked      unchecked      default      delegateleft to right
13Unary+      -      !      ~      ++x      --x      (T)x      true      false      sizeofleft to right
12Multiplicative*      /      %left to right
11Additive+      -left to right
10Shift<<      >>left to right
9Relational and Type testing<      <=      >      >=      is      asleft to right
8Equality==      !=left to right
7Logical And&left to right
6Logical Xor^left to right
5Logical Or|left to right
4Conditional And&&left to right
3Conditional Or||left to right
2Conditional?:right to left
1Assignment=      *=      /=      %=      +=      -=      <<=      >>=      &=      ^=      |=      ??      =>right to left

The operator priority table of C#. The operators that can be overloaded directly are emphasized.

Read more about overloadable C# operators in the text book version of this material.