Re: Generic Collections
- From: Jon Skeet [C# MVP] <skeet@xxxxxxxxx>
- Date: Tue, 27 Nov 2007 20:47:55 -0000
Scott M. <smar@xxxxxxxxxxxxx> wrote:
Given that in .NET 1.x, we could make a strongly-typed collection by
creating a class that inherited from CollectionBase and implementing custom
Add, Remove, and Item members that only work for a given type and that now,
with Generics we don't need to do that extra work, does it mean that to
fully implement a strongly typed Generic collection in .NET 2.0, I need
nothing more than something like this:
Public Class foo(Of T)
Inherits Generic.List(Of T)
End Class
You don't even need that. Just use List(Of T) directly in your code -
unless you're actually adding any functionality to it, why bother
creating a new class to derive from it?
--
Jon Skeet - <skeet@xxxxxxxxx>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
World class .NET training in the UK: http://iterativetraining.co.uk
.
- Follow-Ups:
- Re: Generic Collections
- From: Scott M.
- Re: Generic Collections
- Prev by Date: Re: How to get base data type for enum via reflection
- Next by Date: Re: Generic Collections
- Previous by thread: Re: How to get base data type for enum via reflection
- Next by thread: Re: Generic Collections
- Index(es):
Relevant Pages
|
Loading