size of managed type
How do I get size of managed type in c#
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Kirtan PatelPosted Apr 19, 2009, 10:35 AM
Marshal.SizeOf(Type.GetType("System.Byte"));
Happy Coding :)
DevoraPosted Apr 19, 2009, 8:59 AM
Thanks for your reply,
I had tried the Marshal.SizeOf(). but when I did the following exception was thrown:
"cannot be marshaled as an unmanaged structure; no meaningful size or offset can be computed."
Kirtan PatelPosted Apr 19, 2009, 5:15 AM
use Marshal.SizeOf() to determine the Size of Managed Type
Happy Coding :)