Example code. To begin, numeric suffixes are also called literal number suffixes. They are hints to the compiler that a literal number is of a certain type.
Literal Recall that "literal" means a value hard-coded into your program. The letters are appended to the end of the literals.
Note Literal suffixes on constants generate conv instructions. This means they work the same as runtime casts.
And An "L" instructs the C# compiler that 10000 is a long type. The IL generated is similar to using casts such as (long).
C# program that uses literal number suffixes
static void Main()
// Use long suffix.
long l1 = 10000L;
// Use double suffix.
double d1 = 123.764D;
// Use float suffix.
float f1 = 100.50F;
// Use unsigned suffix.
uint u1 = 1000U;
// Use decimal suffix.
decimal m2 = 4000.1234M;
// Use unsigned suffix and long suffix.
ulong u2 = 10002000300040005000UL;
This table indicates the meaning of the suffix letters. We also see examples of the suffixes in the C# language—the code statements can be used within programs.
Suffix type: unsigned int
Example: uint x = 100U;
Suffix type: long
Example: long x = 100L;
Suffix type: unsigned long
Example: ulong x = 100UL;
Suffix type: float
Example: float x = 100F;
Suffix type: double
Example: double x = 100D;
Suffix type: decimal
Example: decimal x = 100M;
Lowercase suffixes. You can also specify lowercase suffixes. But these are easier to confuse with numbers—the letter "l" is sometimes seen as the number 1. It is best to use L for clarity.
Examples of lowercase suffixes:
Lowercase suffix: long x = 10000l; // Is that 100001 or 10000l?
Uppercase suffix: long x = 10000L; // It's 10000L.
Summary. Suffixes can be used on literal numbers. This is a way to tell the C# compiler that you want the literal number to be treated as a certain type of number, similar to a cast.