Yes, they are not ordinary operators that exist as such elements - instead, there are built-in IL statements.
(The same is almost true for string concatenation, except that the C # compiler builds a call to string.Concat
.)
If you are using C # 4 and .NET 4, the easiest way is to use dynamic typing:
public dynamic Addition(dynamic x, dynamic y) { return x + y; }
For earlier versions, you will need special types of certain types: (
It's not clear what your context is, but you can find Marc Gravell 's article on generic operators .
source share