值类型和引用类型

C#类型分三类:

1.值类型

值类型主要有 int(整型),bool(bool型),float(单精度浮点数),double(双精度浮点数),char(字符串类型),struct(结构体),enum(枚举),sbyte,byte,short,ushort,uint,long,ulong

2.引用类型

引用类型主要有 string(字符串),object(对象),list(集合),class(类),interface(接口),array(数组),delegate(委托)

3.指针类型

在不安全的上下文中,类型可以是指针类型、值类型或引用类型。 指针类型声明采用下列形式之一:

type* identifier;
void* identifier; //allowed but not recommended

以下任一类型均可为指针类型:

sbyte、byte、short、ushort、int、uint、long、ulong、char、float、double、decimal 或 bool。

  • 任何枚举类型。
  • 任何指针类型。
  • 任何仅包含非托管类型字段的用户定义的结构类型
原文地址:https://www.cnblogs.com/Zyj12/p/11022828.html