sizeof() equivalent for reference types?

前端 未结 6 1298
醉酒成梦
醉酒成梦 2020-11-30 12:20

I\'m looking for a way to get the size of an instance of a reference type. sizeof is only for value types. Is this possible?

6条回答
  •  爱一瞬间的悲伤
    2020-11-30 12:41

    Beware that Marshal.SizeOf is for unsafe code...

    I don't think it's possible for managed code though, maybe you can explain your problem, there may be another way to solve it

提交回复
热议问题