There are several ways to specify integer literals in C#. The type is inferred from the value specified. The type used will be the first type in the following list that the literal fits into: int, uint, long or ulong. A suffix can also be used to help indicate the type of the literal.
Types chosen based on suffix (in order preferred):
- u suffix – uint, ulong
- l suffix – long, ulong
- ul suffix – ulong
Here are a few examples:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | // Decimal literals, suffixesobject o1 = 42; // intobject o2 = 2147483647; // intobject o3 = 2147483648; // uintuint u1 = 2; // uintobject u2 = 100U; // uintobject o4 = 4294967296; // longobject o5 = 4294967296U; // ulongobject o6 = 42L; // longobject o7 = 9223372036854775808L; // ulongobject o8 = 42UL; // ulongint n1 = 003;// Hexadecimal literalsint x1 = 0x1A2; // 418object o12 = 0xFFFFFFFF; // 4294967295 uintobject o13 = 0xFUL; // 15, ulong |
Lowercase suffixes are allowed, but you should use uppercase for clarity.

