By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,188 Members | 844 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,188 IT Pros & Developers. It's quick & easy.

Two Classes one for Individual Item Another for a Collection of Items

P: n/a
I am writing a class library. One class is Package and is basically
just the fields for the Package object. Another class is Packages and
is basically used to manage a collection of Package objects.

Could someone point me to some complete example code for this kind of
scenario?

Thanks
Nov 21 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
"slonocode" <oh******@spamsux.sux> wrote in message
news:32*************@individual.net...
I am writing a class library. One class is Package and is basically just
the fields for the Package object. Another class is Packages and is
basically used to manage a collection of Package objects.

Could someone point me to some complete example code for this kind of
scenario?

Thanks


Public Class Package_Collection

Inherits CollectionBase

Default Public Property Item(ByVal index As Integer) As Package

Get

Return CType(List(index), Package)

End Get

Set(ByVal Value As Package)

List(index) = Value

End Set

End Property

Public Function Add(ByVal value As Package) As Integer

Return List.Add(value)

End Function 'Add

Public Function IndexOf(ByVal value As Package) As Integer

Return List.IndexOf(value)

End Function 'IndexOf

Public Sub Insert(ByVal index As Integer, ByVal value As Package)

List.Insert(index, value)

End Sub 'Insert

Public Sub Remove(ByVal value As Package)

List.Remove(value)

End Sub 'Remove

Public Function Contains(ByVal value As Package) As Boolean

' If value is not of type Package, this will return false.

Return List.Contains(value)

End Function 'Contains

End Class
Nov 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.