Internally, Microsoft intermediate language (MSIL) does not understand operator methods. For that reason, the C# compiler converts operator methods into normal functions. Figure A-2 presents a view of the Summation class from the previous section. Although there are no operator methods, there are replacement functions such as op_Addition and op_Explicit. Figure A-2: View of the Summation class

Table A-1 lists the replacement methods for mathematical and logical operators.

Table A-1: Replacement Methods for Mathematical and Logical Operators Open table as spreadsheet

Operator

Replacement Method

operator+

operator-

op_Subtraction

operator*

op_Multiply

operator++

op_Increment

operator--

op_Decrement

operator/

op_Division

operator%

op_Modulus

operator&

op_BitwiseAnd

operator|

op_BitwiseOr

operator^

op_ExclusiveOr

operator false

op_False

operator true

op_True

operator>>

op_RightShift

operator<<

op_LeftShift

operator!

op_LogicalNot

operator~

op_OnesComplement

Table A-2 lists the replacement methods for relational operators.

Table A-2: Replacement Methods for Relational Operators

Operator

Replacement Method

operator>

op_GreaterThan

operator<

op_LessThan

operator>=

op_GreaterThanOrEqual

operator<=

op_LessThanOrEqual

operator==

op_Equality

operator!=

op_Inequality

Conversion operators are implemented as op_Explicit and op_Implicit methods. The methods are overloaded for every combination of explicit or implicit conversion operator provided in the contained type. The following class has two explicit operators and one implicit conversion operator:

```public class ZClass{

public static explicit operator int(ZClass obj) {
return 0;
}

public static explicit operator float(ZClass obj) {
return (float) 0;

}
public static implicit operator double(ZClass obj) {
return 0;
}
}
```

Figure A-3 is an internal view of the application. There are two overloaded op_Explicit methods and a single op_Implicit method. Figure A-3: View of ZClass  Part I: Core Language  Part II: Core Skills  Part III: More C# Language  Part IV: Debugging  Part V: Advanced Concepts  Chapter 14: Memory Management  Chapter 15: Unsafe Code  Appendix A: Operator Overloading  Mathematical and Logical Operators  Conversion Operators  Practical Example  Operator Overloading Internals