我有一个库,其中包含一个具有两种方法的类(以及其他一些不相关的方法):
public T Foo<T>()
{
// Real version does some other things, but this is the gist.
return (T)this.Foo();
}
public object Foo()
{
// Do stuff and return something.
}
到目前为止,一切都很好。这个库编译。
然而,当我打电话时,.Foo<string>()
我得到一个MissingMethodException
. 这可能是什么原因造成的?一切都编译得很好。
作为参考,Foo
没有泛型是遗留方法,我正在介绍泛型版本以帮助进行转换等。