How to determine the size of my class
-
Hi Friends How a size of a class can be determined? As an example
Class A { }
Class A { int i; public A() { i=10; } }
Class B { A aa=new A() public B() { } }
What would be the size of object of type A and B ?? Thanks in advance. :)Thanks, Arindam D Tewary
-
Hi Friends How a size of a class can be determined? As an example
Class A { }
Class A { int i; public A() { i=10; } }
Class B { A aa=new A() public B() { } }
What would be the size of object of type A and B ?? Thanks in advance. :)Thanks, Arindam D Tewary
Unfortunately, there's no quick and easy way (unless you're using Mono where Marshal.SizeOf returns the size of a type in managed code). Common methods for working with size information include using GC.GetTotalMemory, but this is not fine grained enough for the type of detail you want. A better alternative is to use the .NET profiling API. Unfortunately, this means that you are probably going to get down and dirty with C++.
Deja View - the feeling that you've seen this post before.