M
Majed
hi all
i've created a strong named collection which inherits collection base,but
when i try to add to it a nullreferenceexception blows.
the code is as listed below. do i have to init the list myself.
any hints...please!
thanks all
Public Class NewKeys
Inherits BaseCollection
Default Public Property Item(ByVal Index As Integer) As NewKey
Get
Return CType(list(Index), NewKey)
End Get
Set(ByVal Value As NewKey)
List(Index) = Value
End Set
End Property
Public Overrides ReadOnly Property Count() As Integer
Get
Return (MyBase.List.Count())
End Get
End Property
Public Function Add(ByVal value As NewKey) As Integer
Try
Return List.Add(value)
Catch e As Exception
messagebox.show(e.ToString) <------------ it blows here
debug.writeline(e.tostring())
End Try
End Function 'Add
Public Function IndexOf(ByVal value As NewKey) As Integer
Return List.IndexOf(value)
End Function 'IndexOf
Public Sub Insert(ByVal index As Integer, ByVal value As NewKey)
List.Insert(index, value)
End Sub 'Insert
Public Sub Remove(ByVal value As NewKey)
List.Remove(value)
End Sub 'Remove
Public Function Contains(ByVal value As NewKey) As Boolean
' If value is not of type newkey, this will return false.
Return List.Contains(value)
End Function
End Class
i've created a strong named collection which inherits collection base,but
when i try to add to it a nullreferenceexception blows.
the code is as listed below. do i have to init the list myself.
any hints...please!
thanks all
Public Class NewKeys
Inherits BaseCollection
Default Public Property Item(ByVal Index As Integer) As NewKey
Get
Return CType(list(Index), NewKey)
End Get
Set(ByVal Value As NewKey)
List(Index) = Value
End Set
End Property
Public Overrides ReadOnly Property Count() As Integer
Get
Return (MyBase.List.Count())
End Get
End Property
Public Function Add(ByVal value As NewKey) As Integer
Try
Return List.Add(value)
Catch e As Exception
messagebox.show(e.ToString) <------------ it blows here
debug.writeline(e.tostring())
End Try
End Function 'Add
Public Function IndexOf(ByVal value As NewKey) As Integer
Return List.IndexOf(value)
End Function 'IndexOf
Public Sub Insert(ByVal index As Integer, ByVal value As NewKey)
List.Insert(index, value)
End Sub 'Insert
Public Sub Remove(ByVal value As NewKey)
List.Remove(value)
End Sub 'Remove
Public Function Contains(ByVal value As NewKey) As Boolean
' If value is not of type newkey, this will return false.
Return List.Contains(value)
End Function
End Class