sizeof() equivalent for reference types?

前端 未结 6 1315
醉酒成梦
醉酒成梦 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 13:07

    You need Marshal.SizeOf

    Edit: This is for unsafe code, but then, so is sizeof().

提交回复
热议问题