开发者

What is the single character after a value called/exactly do in C#? (eg 1.00m)

What is this feature "called" when you add a literal chracter beside the value of certain types?

decimal d 开发者_Go百科= 1.00m;


It's called suffix.

From the MSDN decimal article:

If you want a numeric real literal to be treated as decimal, use the suffix m or M, for example:


Both uppercase and lowercase suffixes work.

L = long
D = double
F = float
U = unsigned int
M = decimal
UL = unsigned long


Type        Suffix    .NET Framework Type                  
-------------------------------------------------------------------------------------
decimal     M or m    System.Decimal
double      D or d    System.Double
float       F or f    System.Single
int         [1]       System.Int32
long        L or l    System.Int64
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜