【发布时间】:2014-01-09 17:55:54
【问题描述】:
我想创建一个类型化和非类型化的接口,例如 IList 和 IList(Of T)。
我正在寻找的示例用法。 .
Dim a as IList(Of String)
test(a)
public sub test(value as IList){
//I can use the Ilist here without worrying that its an IList(Of String)
}
我想创建一个名为 IRead 的接口,我可以像 IList 接口一样使用它。
//我目前无法让它工作 消息(新测试())
有什么建议吗?
public Interface IRead(Of T)
Get() As T
End
public Interface IRead()
Get() as Object
End Interface
Public Class test
Implements IRead(Of Integer)
Public Function Get() As Integer Implements IRead(Of Integer).Get
Return 35235
End Function
End Class
private sub Msg(value as IRead)
MsgBox(value.GetSingle)
End Sub
【问题讨论】: