Base Collection

I have Units Called ATPUnit with following properties :

    ReadOnly Property Unit() As Integer
    ReadOnly Property Prog() As Integer
    ReadOnly Property RLU() As Integer
    ReadOnly Property Heure() As Date
    ReadOnly Property Test() As Integer


I want to create an ATPUnitColl. So here we go

Public Interface intATPCollUnit

    Default ReadOnly Property Item(ByVal index As Integer) As MeasureUnit
    ReadOnly Property ItemAtTest(ByVal index As Integer) As Integer
    Sub Add(ByVal theATPUnit As ATPUnit)
    Sub Remove(ByVal MeasUnit As MeasureUnit)

End Interface


I have problem on runtime when i try to add an ATPUnit to my collection :

    Public Sub Add(ByVal theATPUnit As ATPUnit) Implements intATPCollUnit.Add
        List.Add(theATPUnit)
    End Sub


Any idea ? Anything missing ? Do I need to "link" the collection via a specific attribute from my collector ?
TheSonicsAsked:
Who is Participating?
 
Bob LearnedConnect With a Mentor Commented:
1) .NET version?

2) Here is an example of a type-specific collection:

Public Class MenuItemCollection : Inherits CollectionBase

  Public Function Add(ByVal item As MenuItem) As Integer

    Return MyBase.List.Add(item)

  End Function

  ' Get an item by index.
  Default Public ReadOnly Property Item(ByVal index As Integer) As MenuItem
    Get
      Return CType(MyBase.List.Item(index), MenuItem)
    End Get
  End Property

End Class

Bob
0
 
TheSonicsAuthor Commented:
In fact I was waking up, i just started thinking about it and it seems to work so far.


By the way thank you man.
Here are some points for you :).



Ritch.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.