C# has the predefined numeric types.
There are three types of predefined numeric types.
Predefined Integral-signed numeric types in C#
C# type | System type | Suffix | Size | Range |
---|---|---|---|---|
sbyte | SByte | No Suffix | 8 bits | -2^7 to 2^7 -1 |
short | Int16 | No Suffix | 16 bits | -2^15 to 2^15-1 |
int | Int32 | No Suffix | 32 bits | -2^31 to 2^31-1 |
long | Int64 | L | 64 bits | -2^63 to 2^63-1 |
Predefined Integral-unsigned numeric types in C#
C# type | System type | Suffix | Size | Range |
---|---|---|---|---|
byte | Byte | No Suffix | 8 bits | 0 to 2^8 -1 |
ushort | UInt16 | No Suffix | 16 bits | 0 to 2^16-1 |
uint | UInt32 | U | 32 bits | 0 to 2^32-1 |
ulong | UInt64 | UL | 64 bits | 0 to 2^64-1 |
Predefined real numeric types in C#
C# type | System type | Suffix | Size | Range |
---|---|---|---|---|
float | Single | F | 32 bits | +/- (~10^-45 to 10^38) |
double | Double | D | 64 bits | +/- (~10^-324 to 10^308) |
decimal | Decimal | M | 128 bits | +/- (~10^-28 to 10^28) |