class ObjectSizer
{
public static long GetSize(object obj)
{
MemoryStream m = new MemoryStream();
BinaryFormatter b = new BinaryFormatter();
try
{
b.Serialize(m, obj);
return m.Length;
}
finally
{
m.Close();
}
}
}
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.