【发布时间】:2010-12-17 04:15:48
【问题描述】:
请看下面的代码:
Public Sub Method(Of TEntity As EntityObject)(ByVal entity As TEntity)
If TypeOf entity Is Contact Then
Dim contact As Contact = entity 'Compile error'
Dim contact = DirectCast(entity, Contact) 'Compile error'
Dim contact = CType(entity, Contact) 'Compile error'
End If
End Sub
有什么想法吗?
【问题讨论】:
标签: vb.net type-conversion casting