Some programming languages allow a type to define how operators should manipulate instances of the type. For example, a lot of types (such as
System.String) overload the equality (
==) and inequality (
!=) operators. The CLR doesn’t know anything about operator overloading because it doesn’t even know what an operator is. Your programming language defines what each operator symbol means and what code should be generated when these special symbols appear.
For example, in C#, applying the
+ symbol to primitive numbers causes the compiler to generate code that adds the two numbers together. When the
+ symbol is applied to strings, the C# compiler generates code that concatenates the two strings together. For inequality, C# ...