Object Size

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi.

How do I get the size of the object at runtime? I tried Marshal.SizeOf, but
it fails with ArgumentException.

Suppose I want to do the following:

DataSet oDS = new DataSet();
// Get the size of oDS

Thanks.
J
 
thejackofall said:
Hi.

How do I get the size of the object at runtime? I tried Marshal.SizeOf,
but
it fails with ArgumentException.

Suppose I want to do the following:

DataSet oDS = new DataSet();
// Get the size of oDS

There is no real way to get the size of an object tree at runtime, which is
waht I assume you want to do. Marshal.SizeOf returns the marshalled size
which is an inefficent estimate.
 
I am looking something equivalent to the sizeof() in C++.

With it, i can get the exact size of the object at runtime.

Thanks.
J
 
Back
Top