数据类型类型系统 C类型 ,配I Franerork类型 bool System.Boolean byte Syster■.Byte sbyte Systen.SByte char Systen.Char decimal Systen.Decinal double Syster■.Doab1e 且oat System.Single int System.Int32 uint Syster■.UInt32 long Syster■.Int64 ulong System.UInt64 object Systen.Object short Syster■.Int16 ushort Syster●.Int16 string System.String
11 数据类型- 类型系统 ▪ 通用类型系统(CTS) ◼ 定义了在中间语言(MSIL)中使用的预定义数据类型 ◼ C#中使用的数据类型都是MSIL数据类型的映射 ◼ 在C#源文件中使用MSIL数据类型也可以 ◼ 例如: “int var =0;” = “Int32 var =0;” ◼ 所有的简单类型都对应.Net平台上定义的结构 (struct) CTS类型 C# 的预定义类型并没有内置于语言中, 而是内置于.Net Framework中,即CTS类 型
值类型Vs.引用类型 C#中所有的类型都继 Reference Types 承于System.Object System.Object 根类型 System.ValueType All Base Class Library classes and interfaces,including: System.Enum 所有的值类型都继承 User-defined System.String 于 classes and interfaces System.Array System.ValueType .Etc. Value Types 类型 All structs,including built-in numeric types All enums System.Int32 System.Boolean User-defined structs .Etc. 12
12 值类型 vs.引用类型 ▪ C#中所有的类型都继 承于System.Object 根类型 ▪ 所有的值类型都继承 于 System.ValueType 类型