One of the things I always seem to be checking are the various characteristics of the C# value types. You know, stupid questions like whether int is the same as System.Int32 or System.Int64. I know the answer, but when I need it, I just want a quick reference. I could not find one, so I made one. I think it is correct since I combined multiple tables from the MSDN documentation.
Value Type
Category
.NET Framework Type
Approximate Range
Default Value
Literal
Size
Precision
Implicit Numeric Conversions
Explicit Numeric Conversions
Signed, numeric, integral
System.SByte
-128 to 127
0
1 byte
-
short, int, long, float, double, or decimal
byte, ushort, uint, ulong, or char
Unsigned, numeric, integral
System.Byte
0 to 255
0
1 byte
-
short, ushort, int, uint, long, ulong, float, double, or decimal
Sbyte or char
Unsigned, numeric, integral
System.Char
\x0000 to \xFFFF (hex)
\u0000 to \uFFFF (uni)
(char)0 to (char)65535
'\0'
2 bytes
-
ushort, int, uint, long, ulong, float, double, or decimal
sbyte, byte, or short
Signed, numeric, integral
System.Int16
-32,768 to 32,767
0
2 bytes
-
int, long, float, double, or decimal
sbyte, byte, ushort, uint, ulong, or char
Unsigned, numeric, integral
System.UInt16
0 to 65,535
0
2 bytes
-
int, uint, long, ulong, float, double, or decimal
sbyte, byte, short, or char
Signed, numeric, integral
System.Int32
-2,147,483,648 to 2,147,483,647
0
4 bytes
-
long, float, double, or decimal
sbyte, byte, short, ushort, uint, ulong, or char
Unsigned, numeric, integral
System.UInt32
0 to 4,294,967,295
0U
U u
4 bytes
-
long, ulong, float, double, or decimal
sbyte, byte, short, ushort, int, or char
Signed, numeric, integral
System.Int64
-9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
0L
L
8 bytes
-
float, double, or decimal
sbyte, byte, short, ushort, int, uint, ulong, or char
Unsigned, numeric, integral
System.UInt64
0 to 18,446,744,073,709,551,615
0UL
UL, ul, Ul, uL, LU, lu, Lu, or lU
8 bytes
-
float, double, or decimal
sbyte, byte, short, ushort, int, uint, long, or char
Numeric, floating-point
System.Single
±1.5e-45 to ±3.4e38
0.0F
F f
4 bytes
7 digits
double
sbyte, byte, short, ushort, int, uint, long, ulong, char, or decimal
Numeric, floating-point
System.Double
±5.0e-324 to ±1.7e308
0.0D
D d
8 bytes
15-16 digits
long
sbyte, byte, short, ushort, int, uint, long, ulong, char, float, or decimal
Numeric, decimal
System.Decimal
±1.0 × 10^−28 to ±7.9 × 10^28
0.0M
M m
16 bytes
28-29 digits
-
sbyte, byte, short, ushort, int, uint, long, ulong, char, float, or double
There is also a PDF that I still need to upload.
