I am learning value types in C# and I noticed this:
when you hover over the value of a declared short, It says that It is a 32-bit int.
I know that a short is a 16-bit int.
Why isn’t It recognizing It as an int, or maybe It does?
>Solution :
you are hovering over the value (32000) which is an int/System.Int32 literal. There isn’t a suffix for short to make a literal short. The compiler will do some gymnastics to ensure that it will fit. For instance, this should not compile.
int max = int.MaxValue;
short aShort = max;
