C# 编译器数字文字
问题描述
有人知道 C# 编译器数字文字修饰符的完整列表吗?
默认情况下,声明 '0' 使其成为 Int32 和 '0.0' 使其成为 'Double'.我可以在末尾使用文字修饰符f"来确保将某些内容视为单一".比如像这样……
我可以使用哪些其他修饰符?是否有一个强制加倍,十进制,UInt32?我试着用谷歌搜索,但找不到任何东西.也许我的术语是错误的,所以这解释了为什么我会出现空白.非常感谢任何帮助.
来自 C# 规范 2.4.4.2 整数文字和 2.4.4.3 实数.请注意,Jon Skeet 推荐的 L 和 UL 是首选,而不是小写变体.p>
Does anyone know the full list of C# compiler number literal modifiers?
By default declaring '0' makes it an Int32 and '0.0' makes it a 'Double'. I can use the literal modifier 'f' at the end to ensure something is treated as a 'Single' instead. For example like this...
What are the other modifiers I can use? Is there one for forcing to Double, Decimal, UInt32? I tried googling for this but could not find anything. Maybe my terminology is wrong and so that explains why I am coming up blank. Any help much appreciated.
From the C# specification 2.4.4.2 Integer literals and 2.4.4.3 Real literals. Take note that L and UL are preferred as opposed to their lowercase variants for clarity as recommended by Jon Skeet.
这篇关于C# 编译器数字文字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!