C#基元类型 | CTS类型 | 范围 | 描述 | |
整
型 | Sbyte | System.SByte |
|
|
Byte | System.Byte |
|
| |
Short | System.Int16 |
|
| |
Ushort | System.Uint16 |
|
| |
Int | System.Int32 |
|
| |
Uint | System.Uint32 |
|
| |
Long | System.Int64 |
|
| |
Ulong | System.Uint64 |
|
| |
浮点型 | Float | System.Single |
|
|
Double | System.Double |
|
| |
布尔型 | Bool | System.Boolean |
|
|
字符型 | Char | Systen.Char |
|
|
个人来说,我也赞成使用CTS类型,原因是:
1:C#中,long类型为64位,而在其他语言中,如C++,long为32位。可能导致语言间的不兼容;
2:FCL(基础类库)中很多方法都是根据CTS来命名的,如:Convert.ToInt32(),Convert.ToInt64()等。