Value types table
Domains:
C#
The following table shows the C# value types.
Value type | Category | Type suffix |
---|---|---|
bool | Boolean | |
byte | Unsigned, numeric, integral | |
char | Unsigned, numeric, integral | |
decimal | Numeric, floating-point | M or m |
double | Numeric, floating-point | D or d |
enum | Enumeration | |
float | Numeric, floating-point | F or f |
int | Signed, numeric, integral | |
long | Signed, numeric, integral | L or l |
sbyte | Signed, numeric, integral | |
short | Signed, numeric, integral | |
struct | User-defined structure | |
uint | Unsigned, numeric, integral | U or u |
ulong | Unsigned, numeric, integral | UL, Ul, uL, ul, LU, Lu, lU, or lu |
ushort | Unsigned, numeric, integral |
Remarks
You use a type suffix to specify a type of a numerical literal. For example:
decimal a = 0.1M;
If an integer numerical literal has no suffix, it has the first of the following types in which its value can be represented: int
, uint
, long
, ulong
.
If a real numerical literal has no suffix, it's of type double
.