patterncsharpCritical
What does the M stand for in C# Decimal literal notation?
Viewed 0 times
literalnotationthefordoesdecimalwhatstand
Problem
In order to work with decimal data types, I have to do this with variable initialization:
What does the M part stand for?
decimal aValue = 50.0M;What does the M part stand for?
Solution
It means it's a decimal literal, as others have said. However, the origins are probably not those suggested elsewhere in this answer. From the C# Annotated Standard (the ECMA version, not the MS version):
The
was already taken by
Although it has been suggested that M
stands for money, Peter Golde recalls
that M was chosen simply as the next
best letter in
A similar annotation mentions that early versions of C# included "Y" and "S" for
The
decimal suffix is M/m since D/dwas already taken by
double.Although it has been suggested that M
stands for money, Peter Golde recalls
that M was chosen simply as the next
best letter in
decimal.A similar annotation mentions that early versions of C# included "Y" and "S" for
byte and short literals respectively. They were dropped on the grounds of not being useful very often.Context
Stack Overflow Q#977484, score: 562
Revisions (0)
No revisions yet.