[Mono-list] Reflection
Paolo Molaro
lupus@ximian.com
Mon, 4 Aug 2003 12:42:58 +0200
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