not really?

  • Thread starter Thread starter Greg Young
  • Start date Start date
G

Greg Young

It works for value types pretty well ;) For reference types you would need
to use unsafe code.

struct Foo {
public int bar;
public int test;
public string str;
}
static void Main(string[] args) {
int foo;
Console.WriteLine(Marshal.SizeOf(typeof(int)));
Console.WriteLine(Marshal.SizeOf(typeof(Foo)));
}


Cheers,

Greg
 
Back
Top