
public class MyClass { public string name { get; set; } public int Age { get; set; } public double Amount { get; set; } } 当我尝试通过使用WinDbg在64位系统上找出这个类的大小时,我得到的大小为40
我无法理解,只要我看到MyClass应该有
8 bytes for SyncBlock8 bytes for TypeHandle8 bytes for string reference4 bytes for Int328 bytes for double= 36 bytes
我没有10个声望,所以我无法发布图像.
任何人都知道为什么WinDbg显示4个额外的字节?
Of Memory and strings (Jon Skeet’s blog)
Benchmarking C# Struct and Object Sizes
Drill Into .NET Framework Internals to See How the CLR Creates Runtime Objects
How Much Memory Does a C# String Take Up
总结以上是内存溢出为你收集整理的如何确定对象的大小,c#?全部内容,希望文章能够帮你解决如何确定对象的大小,c#?所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)