The available addition operators in C# only contemplate int
, uint
, long
and ulong
data types so in that case you are implicitly casting two ushort
instances to int
, then performing the addition and then returning an int
that cannot be implicitly cast to ushort
.
From the C# 4.0 specification, section 7.8.4 Addition operator, you can check that only the the following integer addition operators are available:
int operator +(int x, int y);
uint operator +(uint x, uint y);
long operator +(long x, long y);
ulong operator +(ulong x, ulong y);
The same section also states:
The operands are converted to the
parameter types of the selected
operator, and the type of the result
is the return type of the operator.
Which explains why that expression results in an int
.