Re: How to know a class 's size?
- From: shanemjtownsend@xxxxxxxxxxx
- Date: 14 Dec 2006 02:26:47 -0800
Kevien Lee wrote:
If there are some int,string ,ushort filed in a class,How to find out
how it would cost of the memery?
Hi Kevien
I have a similar problem and as you can see from the other posts, the
sizeof function only works on value types, so not much use for objects.
Personally I just serialize the object to either a temp file (or
memory) and check the stream pointer or file length afterwards (which
is your object size!). It's a bit clunky but it works.
Hope this helps
Shane
.
- References:
- How to know a class 's size?
- From: Kevien Lee
- How to know a class 's size?
- Prev by Date: Re: How to know a class 's size?
- Next by Date: .NET and multithread networks server application
- Previous by thread: Re: How to know a class 's size?
- Next by thread: Re: # of current physical Threads > 4 000 000 0000
- Index(es):