1
我不知道该怎么解释这一点,我想下面的方法来工作,但它给了我错误说泛型帮助需要
的
as' operator cannot be used with a non-reference type parameter
T”。考虑添加`class'或引用类型约束。
任何人都可以帮我解决这个问题吗?
public T GetRoot<T>() {
if (this is T)
return this as T;
if (parent != null)
return parent.GetRoot<T>();
return null;
}