0

I have a variable in the session; how do I find out its size?

Thanks

frenchie
  • 51,731
  • 109
  • 304
  • 510
  • Size of what? if you want the memory size, possible duplicate http://stackoverflow.com/questions/426396/how-much-memory-does-a-c-net-object-use, http://stackoverflow.com/questions/324053/find-out-the-size-of-a-net-object and http://stackoverflow.com/questions/207592/getting-the-size-of-a-field-in-bytes-with-c – The Scrum Meister Feb 02 '11 at 04:04
  • Related: http://stackoverflow.com/questions/760230/is-serialization-reliable-for-object-size-estimation - Is Serialization reliable for object size estimation? – Justin Morgan Feb 02 '11 at 04:06

1 Answers1

0
int mySizeize = sizeof(myVariable);

will not work for reference type

or Marshal.SizeOf Method (Object)

http://msdn.microsoft.com/en-us/library/y3ybkfb3.aspx

Kris Ivanov
  • 10,476
  • 1
  • 24
  • 35