I quickly go through Int32 struct definition, and I do not find any overload to operators like + - * /, but for String class, we can directly find them. How does Int32 implement such feature?
Asked
Active
Viewed 196 times
4
-
2It is built into the language. Also the basic reason why you cannot write generic code that uses those operators. – Hans Passant Aug 02 '16 at 07:31
-
@HansPassant I see, thanks – Bargitta Aug 02 '16 at 07:51
1 Answers
3
They are baked into the CLR, and are not part of the code outputted as Reference Source. Hence you can't find them.
For String
, only two operators are visible: those written in C#. Those in the CLR are also not shown (like the +
operator).

Patrick Hofman
- 153,850
- 22
- 249
- 325