Hello,
I understand that the primitive types in the base class library are handled
on iml-level. But when I look at the source code of rotor, I see that all
the primitive types like int32, double, etc. are structures drived from
ValueType, and these structures are using, well, the actual(?) primitive
types themselves. Many books and articles I read about the bcl say that it
doesn't matter (performance-related) if you use - in c# for example - Int32
or the "real" int. But if I use the Int32 in my code, doesn't that
necessarily mean that there is a code overhead, which I better avoid?
Maybe there are some articles out there explaining the interaction between
the bcl and the IML-type-using-and-resolving-thingy (hope, that's not the
actual technical term ;- ) properly?
Thanks for your help,
Klaus
Chris Taylor - 22 Oct 2003 23:01 GMT
Hi,
Using 'int' in C# is just an alias (for lack of a better term) for the
System.Int32. So when you declare a int you are infact declaring a
System.Int32, therefore the IL that is generated is the same.
My understanding (and anyone please jump in here) the fact that System.Int32
is a sealed ValueType and is a blitable ie. the memory layout of the
System.Int32 is 4 bytes, the CLR to take advantage of these attributes to
optimize the use of these primitives and provide the object oriented nature.
Since it is sealed there is no chance of something causing the memory
structure to be altered.
Hope this helps
Chris Taylor
> Hello,
>
[quoted text clipped - 14 lines]
>
> Klaus