The suffixes in the table below are useful because they tell the compiler what type a numeric literal is and how it should be treated. The default type of a numeric literal is integer (int) of course, but if you want to specify decimal or long, how would you do that? (please don’t cast it, it’s ugly)
Consider having an overloaded method, one overload takes a parameter of type long, another of type int, now if you want to pass in the number ‘15′ for example, these suffixes will help you choose which overload to actually invoke by appending a letter (or two) to the numeric literal.
| Type |
Suffix |
Example |
| uint |
U or u |
100U |
| long |
L or l |
100L |
| ulong |
UL or ul |
100UL |
| float |
F or f |
123.45F |
| decimal |
M or m |
123.45M |
Note that the suffixes are case-insensitive.