I have the following code:
Imports System.Collections.ObjectModel
Public Class clsCellListExtender
Public Class List(Of T)
Inherits Collection(Of T)
Private _iID As Integer = 0
Protected Overrides Sub InsertItem(index As Integer, item As T)
'your checks here
If TypeOf (item) Is clsCell Then
_iID += 1
Dim nCell As clsCell = DirectCast(item, clsCell)
nCell.TempID = _iID
End If
MyBase.InsertItem(index, item)
End Sub
End Class
End Class
When I try to compile it, the compiler tells me that "T cannot be converted to clsCell" in the line
Dim nCell As clsCell = DirectCast(item, clsCell)
Can somebody please tell me what I did wrong?
Thank you!