Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / CLR / October 2003

Tip: Looking for answers? Try searching our database.

Primitive Types - what resolves them?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Klaus L?ffelmann - 22 Oct 2003 22:19 GMT
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

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.