You can implicitly convert from char to any numeric type that can store values in the range [0,65535]. This means that you can convert to int implicitly, as well as ushort, but not to short.
1
2
3
4
5
| char c1 = 'X' ; int n1 = c1; // Implicit conversion to numeric ushort s1 = c1; // Also works short s2 = c1; // Implicit not allowed, must cast byte b = c1; // Implicit not allowed, must cast |
You can also convert from a numeric type to a char, but no implicit conversion exists–you must always use a cast or the Convert class.
1
2
| short n2 = 90; char c2 = ( char )n2; // No implicit conversion, must use cast |