ECMA-334 C# Language Specification14.2.6: Numeric promotions (informative) |
This clause is informative.
Numeric promotion consists of automatically performing certain implicit conversions of the operands of the predefined unary and binary numeric operators. Numeric promotion is not a distinct mechanism, but rather an effect of applying overload resolution to the predefined operators. Numeric promotion specifically does not affect evaluation of user-defined operators, although user-defined operators can be implemented to exhibit similar effects.
As an example of numeric promotion, consider the predefined implementations of the binary * operator:
int operator *(int x, int y); uint operator *(uint x, uint y); long operator *(long x, long y); ulong operator *(ulong x, ulong y); float operator *(float x, float y); double operator *(double x, double y); decimal operator *(decimal x, decimal y); |
When overload resolution rules (14.4.2) are applied to this set of operators, the effect is to select the first of the operators for which implicit conversions exist from the operand types.
End of informative text.
In This Section: