Re: Boxing and Unboxing ??
- From: Bob Graham <rvgrahamsevateneinKnowSpam@xxxxxxxxxxxxx>
- Date: 12 Jan 2007 15:01:03 -0800
Value types are stored on the "Stack" and go away, as it were, immediately
when they go out of scope. Mostly numeric types and structs.
Reference types are stored on the "Heap" and are garbage collected when
the system feels like it. References to ref types are passed normally as
a pointer to the address. Value types are passed a copy of the value.
I'm sure someone with more years under their Microsoft belt will chime
in here with a more exlicit and concise answer, but this is basically how
it is.
Bob
According to Troelsen in "C# and the .NET Platform"
"Boxing can be formally defined as the process of explicitly converting
a value type into a corresponding reference type."
I think that my biggest problem with this process is that the terms
"value type"
and "reference type" mean something entirely different than what they
mean on every other platform in every other language. Normally a value
type is the actual data itself stored in memory, (such as an integer)
and a reference type is simply the address of this data.
It seems that .NET has made at least one of these two terms mean
something entirely different. can someone please give me a quick
overview of what the terms "value type" and "reference type" actually
mean in terms of their underlying architecture?
Posted by NewsLook (Trial Licence) from http://www.ghytred.com/NewsLook/about.aspx
.
- Follow-Ups:
- Re: Boxing and Unboxing ??
- From: Jon Skeet [C# MVP]
- Re: Boxing and Unboxing ??
- From: Peter Olcott
- Re: Boxing and Unboxing ??
- References:
- Boxing and Unboxing ??
- From: Peter Olcott
- Boxing and Unboxing ??
- Prev by Date: Combo box API trickery
- Next by Date: File Attachements from database
- Previous by thread: Boxing and Unboxing ??
- Next by thread: Re: Boxing and Unboxing ??
- Index(es):
Relevant Pages
|
Loading