CSharp examples for Custom Type:Operator Overloading
Operators can be overloaded to provide more natural syntax for custom types.
The following symbolic operators can be overloaded:
+ (unary) - (unary) ! ~ ++ -- + - * / % & | ^ << >> == != > < >= <=
The following operators are also overloadable:
The following operators are indirectly overloaded:
The compound assignment operators (e.g., +=, /=) are implicitly overridden by overriding the noncompound operators (e.g., +, /).
The conditional operators && and || are implicitly overridden by overriding the bitwise operators & and |.