How to get Size of a object (class, structure) in c#-Collection of common programming errors
I am attempting to perform a perverse memory trick by calculating the size of an object (one of many in a serial fashion), so I can jump forward in the memory stream to the next one.
This is for a managed class. I’ve seen reference to sizeof and Mashal.SizeOf, but they appeared in reference to unmanaged types or value types.
So, does anyone know a way to do this at runtime, or should I break out the calculator and it do it manually in the code?