如何值类型的数组存储在.NET对象堆? [英] How is an array of value types stored in .NET object heap?

查看:286
本文介绍了如何值类型的数组存储在.NET对象堆?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在.NET中,值类型的对象,如int存储在内存中。

In .NET, Value type object such as int is stored in memory.

引用类型的对象,需要的内存的引用和对象单独分配,而对象存储在.NET对象堆。

Reference type object requires separate allocations of memory for the reference and object, and the object is stored in .NET object heap.

和数组是在堆上创建的,所以值类型的数组,如int []存储在堆怎么样?这是否意味着值类型的对象可以存储在堆没有拳击?

And Array is created in the heap, so how an array of value types such as int[] stored in the heap? Does it mean value type object can be stored in the heap without boxing?

推荐答案

是的,你是对的。我建议你​​这样说的:

Yes, you are right. I suggest you read this:

<一个href="http://blogs.msdn.com/b/ericlippert/archive/2010/09/30/the-truth-about-value-types.aspx">http://blogs.msdn.com/b/ericlippert/archive/2010/09/30/the-truth-about-value-types.aspx

这是非常非常好,它说明了你永远想知道的几乎一切。

It's very very good, and it explains nearly everything you'll ever want to know.

这篇关于如何值类型的数组存储在.NET对象堆?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆