我收到以下错误:
ClassName.PropertyName 无法实现 IClassType.PropertyName 因为它没有匹配的返回类型 IBasePropertyType
现在,对于代码:
public class ClassName : IClassType
{
public IChildPropertyType PropertyName { get; set; }
}
public interface IClassType
{
public IBasePropertyType PropertyName { get; set; }
}
public interface IBasePropertyType
{
// some methods
}
public interface IChildPropertyType : IBasePropertyType
{
// some methods
}
有没有办法做我正在尝试的事情?我知道问题在于协/逆变,但我似乎无法弄清楚如何做到这一点。