【发布时间】:2011-03-28 16:03:22
【问题描述】:
如果我有一个清单...
dim l as List(of MyClass) = new List(of MyClass)
我想获取列表中包含的对象的类型,我该怎么做?
从我的实际实现中似乎不可能的明显答案是做这样的事情......
public function GetType(byval AList as IList(of GenericType)) as System.Type
dim lResult as system.type = nothing
if AList.Count > 0 then lResult = AList(0).GetType
return lResult
end function
但是如果列表是空的,我还想知道它包含的类型呢?
【问题讨论】: