[Mono-list] Reflection

Thong (Tum) Nguyen tum@veridicus.com
Mon, 4 Aug 2003 22:50:03 +1200


True but I think Gius wanted to know the size of a type from a Type
reference.  I think the sizeof(int) was just an example.

^Tum


> -----Original Message-----
> From: mono-list-admin@lists.ximian.com [mailto:mono-list-
> admin@lists.ximian.com] On Behalf Of Paolo Molaro
> Sent: Monday, 4 August 2003 10:43 p.m.
> To: 'Mono'
> Subject: Re: [Mono-list] Reflection
> 
> On 08/02/03 Thong (Tum) Nguyen wrote:
> > Try System.Runtime.InteropServices.Marshal.SizeOf(Type).
> [...]
> > > From: mono-list-admin@lists.ximian.com [mailto:mono-list-
> > > admin@lists.ximian.com] On Behalf Of Giuseppe Greco
> [...]
> > > sorry for my stupid question... but does anybody know how
> > > can I get the size of a type without using sizeof()?
> > >
> > > For example, sizeof(Int32) returns 4; how can I obtain the
> > > same result using the Type class?
> 
> Marshal.SizeOf is not the same as the IL sizeof instruction.
> sizeof(Int32) is always a constant (4) so you don't need it.
> 
> lupus
> 
> --
> -----------------------------------------------------------------
> lupus@debian.org                                     debian/rules
> lupus@ximian.com                             Monkeys do it better
> _______________________________________________
> Mono-list maillist  -  Mono-list@lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list