나는 다음과 같은 코드가 있습니다DirectCast 오류
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
나는 그것을 컴파일하려고하면 컴파일러가 라인
Dim nCell As clsCell = DirectCast(item, clsCell)
수 누군가에 "T는 clsCell로 변환 할 수 없습니다"라고 나에게 이야기를 내가 뭘 잘못했는지 말해줘?
감사합니다.
'List (Of T) '라는 내부 클래스를 사용하는 데 문제가 있습니다. – Plutonix
왜 문제가 있습니까? – tmighty