那么是否有可能获取Property<T>
is的实例,Property
并且在不知道其泛型T
类型参数的情况下调用其方法?
private interface Property<T>
{
T Value { get;}
void DestroyEarth();
}
class MyProperty : Property<int>
{
public int Value{ get { return 1 }; }
public void DestroyEarth() { }
}
所以我想知道我是否可以调用DestroyEarth()
MyProperty 实例收到的方法,如
void PropertyCaller(Property p){p.DestroyEarth();}
(注意:我们没有定义或没有简单的Property
类或接口 nowhere )