sizeof operator

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I am new to C#. Just wondering how to measure the size of struct I defined in managed code(in bytes).
How can I use sizeof to achieve that ?

Thanks
 
There is also System.Runtime.InteropServices.Marshal.SizeOf(). This relaxes the
value-type only constraint. It does
require an UnmanagedCode permission, but doesn't require that you compile your
application with the unsafe flag.
 
Back
Top