什么是M分别表示在C#十进制的文字符号? [英] What does the M stand for in C# Decimal literal notation?
问题描述
为了与十进制数据类型的工作,我有变量初始化做到这一点:
In order to work with decimal data types, I have to do this with variable initialization:
decimal aValue = 50.0M;
什么是M部代表什么?
What does the M part stand for?
推荐答案
这意味着它是一个十进制字面,正如其他人说。然而,起源可能不是那些在这个答案在别处建议。从 C#标准批注(ECMA的版本,而不是MS版):
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):
的小数
后缀是因为D / D M / M
已经采取的双击
。
虽然已建议在于M
代表金钱,彼得·金果回忆说:
那个M的简单选为下一
在小数最好的信
。
The
decimal
suffix is M/m since D/d was already taken bydouble
. Although it has been suggested that M stands for money, Peter Golde recalls that M was chosen simply as the next best letter indecimal
.
一个类似的注释中提到,C#的早期版本包括Y和S为字节
和短
分别文字。他们投下不是有用经常的理由。
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.
这篇关于什么是M分别表示在C#十进制的文字符号?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!