码迷,mamicode.com
首页 > Web开发 > 详细

深入解密.NET(GC垃圾回收)

时间:2017-05-11 10:17:28      阅读:174      评论:0      收藏:0      [点我收藏+]

标签:结构   nullable   bsp   int   垃圾回收   system.in   char   alt   类型   

值类型与引用类型

值类型(Value Type),值类型实例通常分配在线程的堆栈(stack)上,并且不包含任何指向实例数据的指针,因为变量本身就包含了其实例数据

C#的所有值类型均隐式派生自System.ValueType:

结构体:struct(直接派生于System.ValueType),用户定义的结构体(派生于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的别名);

 枚举:enum(派生于System.Enum);

可空类型、派生于System.Nullable<T>泛型结构体,T?实际上是System.Nullable<T>的别名。

引用类型

C#有以下一些引用类型:

数组(派生于System.Array)

类:class(派生于System.Object);

接口:interface;

委托:delegate(派生于System.Delegate)。

object(System.Object);

字符串:string(System.String)。 

内存图(stack、Heap):

托管堆是基于进程的。

技术分享

 

GC

 

深入解密.NET(GC垃圾回收)

标签:结构   nullable   bsp   int   垃圾回收   system.in   char   alt   类型   

原文地址:http://www.cnblogs.com/xmai/p/6795140.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!