Have you tried: System.Runtime.InteropServices.Marshal.SizeOf(yourObj) ?
This is not exactly what you are looking for but can give you an idea.
There's no supported way of determining the size of a managed object, except
if it is a value type. Then you can use the sizeof C# operator.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.