all groups > vb.net controls > june 2006 >
You're in the

vb.net controls

group:

collections?


collections? HockeyFan
6/20/2006 9:22:01 AM
vb.net controls:
I've never created a class using collection, but would like to.
I have a class called Contact. I'd like to create a ContactCol class that
is a collection of Contact instances.
In VB.Net, how do I do this?
Re: collections? Claes Bergefall
6/20/2006 5:38:43 PM
Assuming you're using 2005 the simplest thing is to use generics

Public Class ContactCollection
Inherits System.Collections.Generic.List(Of Contact)
End Class

That's all that's needed. If you don't want/need a separate class you can
just create an instance of List(Of Contact) directly


If you're using 2003 you should inherit CollectionBase. There are articles
in MSDN on how to do that properly (just search for CollectionBase in the
help files).

/claes


[quoted text, click to view]

AddThis Social Bookmark Button