C # 规范(版本4)为某些类型定义了关键字别名,也定义了为某些值指定文本的方法; 它还分别定义了常量表达式中可用的类型; 与 C # 最接近的“原语类型”概念在第4.1.4节: 简单类型。(在600页的文档中,“原语”这个词只用了两次) ; 这些原语类型被简单地定义为“在 C # 中具有关键字别名的值类型”——这一部分没有提到 string:
System.SByte (sbyte)
System.Byte(byte)
System.Int16 (short)
System.UInt16(ushort)
System.Int32(int)
System.UInt32(uint)
System.Int64(long)
System.UInt64(ulong)
System.Char(char)
System.Single(float)
System.Double(double)
System.Boolean(bool)
System.Decimal(decimal)
You will see that there is only a partial overlap between all of these things; the CLR sees both pointer types as primitive, both VB.NET and C# see decimal as a primitive/simple type, only VB.NET sees DateTime as anything special, both VB.NET and C# have a keyword alias and a literal syntax for strings but only VB.NET specifies String as being a "primitive type", while C# simply has a section of its specification dedicated to System.String...