一些字母后,又是什么叫什么? [英] Letter after a number, what is it called?

查看:157
本文介绍了一些字母后,又是什么叫什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是什么叫做

double  d1 = 0d;
decimal d2 = 0L;
float   d3 = 0f;

和我在哪里可以找到我的字符可以使用的参考?如果我想投 0 ,我需要这封信?

And where can I find a reference of characters I can use? If I want to cast 0 to short, which letter I need?

推荐答案

最好的来源是C#规范(这是在第2.4.4字面在第4版)。

The best source is the C# specification (it's in section "2.4.4. Literals" in version 4).

的相关位:

类型字面如下确定的整数:

The type of an integer literal is determined as follows:


  • 如果文字没有后缀,它的第一个这种类型中,它的价值可以表示的:INT,UINT,长,ULONG

  • 如果文字是接U或u后缀,它的第一个这种类型中,它的价值可以表示的:UINT,ULONG

  • 如果文字是用L后缀或L,它的第一个这种类型中,它的价值可以表示的:长,ULONG

  • 如果文字是通过UL认证,UL认证,UL认证,UL,LU,鲁后缀,鲁,或LU,它是ulong类型。

  • If the literal has no suffix, it has the first of these types in which its value can be represented: int, uint, long, ulong.
  • If the literal is suffixed by U or u, it has the first of these types in which its value can be represented: uint, ulong.
  • If the literal is suffixed by L or l, it has the first of these types in which its value can be represented: long, ulong.
  • If the literal is suffixed by UL, Ul, uL, ul, LU, Lu, lU, or lu, it is of type ulong.

如果没有指定实型后缀,真正的类型文字是双。否则,实类型后缀决定了实数的类型,如下所示:

If no real-type-suffix is specified, the type of the real literal is double. Otherwise, the real type suffix determines the type of the real literal, as follows:


  • 一个实数以F或f为后缀是float类型。 [...]

  • A real literal suffixed by F or f is of type float. […]

一个实数由D或D后缀是double类型。 [...]

A real literal suffixed by D or d is of type double. […]

一个实数以M或m为后缀类型小数。 [...]

A real literal suffixed by M or m is of type decimal. […]

这意味着字母(或字母)被称为后缀。有没有办法来表示这样,所以你必须使用(短)0 ,或只是短的X = 0;

That means the letter (or letters) is called "suffix". There is no way to represent short this way, so you have to use (short)0, or just short x = 0;.

这篇关于一些字母后,又是什么叫什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆