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 3 : 20
Object-oriented Programming in C#
Operators, Delegates, and Events
Overloadable operators in C#

Overview of overloadable operators.

A subset of the C# operators are overloadable

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/bitwise And&left to right
6Logical/bitwise Xor^left to right
5Logical/bitwise 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.