如果我有清单...
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
但是如果列表是空的并且我仍然想知道它包含的类型怎么办?