custom collection using generics

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Dan Holmes

    #1

    custom collection using generics

    Given the Class named KeyValue is the declaration for the Dictionary
    version correct? I can't get the IDE to like it. This is VS2005 beta
    2. I think i am doing something wrong but i don't see it.

    Public Class KeyValue
    Dim _keyID As FieldAttributes
    Dim _value As FieldAttributes
    'public accessors omitted
    End Class
    Public Class KeyValueDiction ary(Of KeyValue) : Inherits DictionaryBase
    Public Sub Add(ByVal value As KeyValue)
    Dictionary.Add( value.keyID.val ue, value) 'ide doesn't like this line.
    End Sub 'Add
    end Class

    dan
  • Ken Tucker [MVP]

    #2
    Re: custom collection using generics

    Hi,

    Try this instead

    Public Class KeyValueDiction ary: Inherits DictionaryBase
    Public Sub Add(ByVal value As KeyValue)
    Dictionary.Add( value.keyID.val ue, value) 'ide doesn't like this line.
    End Sub 'Add
    end Class

    Ken
    ----------------
    "Dan Holmes" <danholmes@bigf oot.com> wrote in message
    news:%23NHZQKTy FHA.2348@TK2MSF TNGP15.phx.gbl. ..[color=blue]
    > Given the Class named KeyValue is the declaration for the Dictionary
    > version correct? I can't get the IDE to like it. This is VS2005 beta 2.
    > I think i am doing something wrong but i don't see it.
    >
    > Public Class KeyValue
    > Dim _keyID As FieldAttributes
    > Dim _value As FieldAttributes
    > 'public accessors omitted
    > End Class
    > Public Class KeyValueDiction ary(Of KeyValue) : Inherits DictionaryBase
    > Public Sub Add(ByVal value As KeyValue)
    > Dictionary.Add( value.keyID.val ue, value) 'ide doesn't like this line.
    > End Sub 'Add
    > end Class
    >
    > dan[/color]


    Comment

    Working...