c# - Where are the operations for String , Int32, etc are defined? -


I was looking at the string and int 32 types through the reflector, but no operators have been defined.

If they are not defined, how do these types work on +/-, etc?

The digital operator is a part of IL itself. The "+" operator on the wire is very special - it is not overloaded in string type, it has been done by the compiler. C # compiler translation:

  string x = a + "hello" + b;  

In:

  string x = string. Kanakat (a, "hello", b);  

It is more efficient in comparison to that if a combination is done using the normal operator, because otherwise a new string should be created in each combination.


Comments