Re: Boxing and Unboxing ??
- From: "Peter Olcott" <peteolcott@xxxxxxxxx>
- Date: Mon, 15 Jan 2007 17:01:08 -0600
"Ignacio Machin ( .NET/ C# MVP )" <machin TA laceupsolutions.com> wrote in
message news:upAgdrOOHHA.4172@xxxxxxxxxxxxxxxxxxxxxxx
Hi,I don't think so.
"Peter Olcott" <NoSpam@xxxxxxxxxxxxx> wrote in message
news:ohWph.62189$9S6.3105@xxxxxxxxxxxxxxx
| So with Generics Boxing and UnBoxing beomes obsolete?
Not at all.
Generics simply offer the mechanisn for you not to be forced to use a
"cover all instances type" type when you declare a class. Before generics
you used to declare collections as storing objects. as you knew for sure
that EVERYTHING could be converted to an object reference (this imply boxing
with value types). This allowed you to write ONE ArrayList class and use it
with any kind of types.
Of course you could always write one for each value type plus one for
references type this would prevent boxing/unboxing
Now with generic you are taking the second approach one level further. It's
the compiler now who create that class for you at compile time.
But boxing/unboxing will still be there, forever and ever :)
.
- Follow-Ups:
- Re: Boxing and Unboxing ??
- From: Ignacio Machin \( .NET/ C# MVP \)
- Re: Boxing and Unboxing ??
- From: Jesse McGrew
- Re: Boxing and Unboxing ??
- From: Arne Vajhøj
- Re: Boxing and Unboxing ??
- References:
- Boxing and Unboxing ??
- From: Peter Olcott
- Re: Boxing and Unboxing ??
- From: Bob Graham
- Re: Boxing and Unboxing ??
- From: Peter Olcott
- Re: Boxing and Unboxing ??
- From: Bob Graham
- Re: Boxing and Unboxing ??
- From: Peter Olcott
- Re: Boxing and Unboxing ??
- From: Ignacio Machin \( .NET/ C# MVP \)
- Boxing and Unboxing ??
- Prev by Date: Re: Boxing and Unboxing ??
- Next by Date: Re: Boxing and Unboxing ??
- Previous by thread: Re: Boxing and Unboxing ??
- Next by thread: Re: Boxing and Unboxing ??
- Index(es):
Relevant Pages
|
Loading