C#数据类型与.NET CTS的映射关系C#语言中常见值类型,如:int、float、double、bool等都是.NET CTS(通用类型系统)的别名,附表如下:
C# 类型
.NET Framework 类型
bool
System.Boolean
byte
System.Byte
sbyte
System.SByte
char
System.Char
decimal
System.Decimal
double
System.Double
float
System.Single
int
System.Int32
uint
System.UInt32
long
System.Int64
ulong
System.UInt64
object
System.Object
short
System.Int16
ushort
System.UInt16
string
System.String
那么我们申明变量并初始化就有两种选择啦
例如:
int s = 15;
Int32 w = s;
其它类型和int类型相同。