Ashok,
In addition to the other comments.
I normally use the collection classes in System.Collections.ObjectModel to
define my strongly typed collections. I reserve List(Of T) & Dictionary(Of
T) for implementation details and generally don't inherit directly from
them.
For example:
Public Class ArticleCollection
Inherits System.Collections.ObjectModel.Collection(Of Article)
End Class
Will produce a fully typed safe collection including remove, indexof, copyto
etc...
http://msdn2.microsoft.com/en-us/lib...jectmodel.aspx
I will inherited from Collection(Of T) to create a custom base class that
will add additional common functionality to my strongly typed collections.
For example:
Public MustInherit Class DomainCollection(Of T)
Inherits System.Collections.ObjectModel.Collection(Of T)
Public Function Find(ByVal match As Predicate(Of T)) As T
Dim list As List(Of T) = TryCast(Me.Items, List(Of T))
If list Is Nothing Then Return Nothing
Return list.Find(match)
End Function
End Class
Public Class ArticleCollection
Inherits DomainCollection(Of Article)
End Class
--
Hope this helps
Jay B. Harlow [MVP - Outlook]
..NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley -
http://www.tsbradley.net
"Showjumper" <dfgkjhdf> wrote in message
news:OB**************@TK2MSFTNGP02.phx.gbl...
|
| Back in asp.net 1.1 i made custom collection classes per Karl Seguin's
| article On the Way to Mastering ASP.NET: Introducing Custom Entity Classes
| to take advantage of strongly typed data. Now with generics i understand
| that one doesnt have to used these custom collections. So i want to move
| this 1.1 project to 2.0. I have been reading about generics but i geuss i
| dont really get hpw to implement them. For example i have 2 classees in
the
| 1.1 projecy - Articles which exposes the various properties and the custom
| articlescollections that has the various methods remove, indexof, copyto
| etc. How do i make the move to generics and still have my strongly typed
| data? I assum i would still have the articles class but would only have a
| single generic collection class that could accept varous types?
|
| Thanks
| Ashok
|
|
|