collection

hi,

I am using vs basic.net 2005 to do a project.

Now I have a base class, such as

Public Class ParaBase

Dim title As [Enum]

Dim variable As String

Dim value As String

Sub New()

title = Nothing

variable = ""

value = ""

End Sub

Public Property UIName() As [Enum]

Get

UIName = title

End Get

Set(ByVal value As [Enum])

title = value

End Set

End Property

Public Property ValueStr() As String

Get

ValueStr = value

End Get

Set(ByVal v As String)

value = v

End Set

End Property

Public Property MACVar() As String

Get

MACVar = variable

End Get

Set(ByVal value As String)

variable = value

End Set

End Property

Public ReadOnly Property UIKey() As String

Get

UIKey = title.ToString

End Get

End Property

End Class

Now I want to create a collection class for this base class, like that:

Public class paracol

Inherits System.Collections.Generic.List(Of ParaBase)

end class

Now I have questions:

In a collection variable, when we add new object inside, we can set key name for that object, which means we can use that key to access this object instead of index, but my collection class can't not do that anybody can know how to that Thank you very much!




Answer this question

collection

  • Tim Golisch

    A sortedlist or a hashtable does this. A list does not.

    You should just create a List of the type, you don't need to create a class.

    Dim col as List<Parabase> = new List<Parabase>

    Or doesn't that syntax work in VB.NET



  • collection