【发布时间】:2010-08-24 09:20:02
【问题描述】:
可以说,如果我遇到以下情况。
Type somethingType = b.GetType();
// b is an instance of Bar();
Foo<somethingType>(); //Compilation error!!
//I don't know what is the Type of "something" at compile time to call
//like Foo<Bar>();
//Where:
public void Foo<T>()
{
//impl
}
编译时不知道类型怎么调用泛型函数?
【问题讨论】:
-
其他许多。请在询问之前使用搜索。