|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
not really?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 Show quote "Leon_Amirreza" <amirreza_rahm***@yahoo.com> wrote in message news:ehYYalntGHA.1216@TK2MSFTNGP03.phx.gbl... >I dont think marshal.sizeof() wroks for managed objects!? > does it? > |
|||||||||||||||||||||||