备份录——遗漏知识点
一、自动补零
padLeft && padRight——left是左补,right是右补。

二、概念
值类型(栈)
C#的所有值类型均隐式派生自System.ValueType:
结构体:struct(直接派生于System.ValueType);
数值类型:
- 整型:sbyte(System.SByte的别名),short(System.Int16),int(System.Int32),long(System.Int64),byte(System.Byte),ushort(System.UInt16),uint(System.UInt32),ulong(System.UInt64),char(System.Char);
- 浮点型:float(System.Single),double(System.Double);
- decimal型:decimal(System.Decimal)。
- bool型:bool(System.Boolean的别名);
- 用户定义的结构体(派生于System.ValueType)。
- 枚举:enum(派生于System.Enum);
- 可空类型(派生于System.Nullable<T>泛型结构体,T?实际上是System.Nullable<T>的别名)。
每种值类型均有一个隐式的默认构造函数来初始化该类型的默认值。
引用类型(堆)
C#有以下一些引用类型:
- 数组(派生于System.Array)
- 用户用定义的以下类型:
- 类:class(派生于System.Object);
- 接口:interface(接口不是一个“东西”,所以不存在派生于何处的问题。Anders在《C# Programming Language》中说,接口只是表示一种约定[contract]);
- 委托:delegate(派生于System.Delegate)。
- object(System.Object的别名);
- 字符串:string(System.String的别名)。

浙公网安备 33010602011771号