Вот код, который я пробовал:
Код: Выделить всё
interface IMainBody
{
ISubProperty subProperty { get; set; }
}
interface ISubProperty
{
string somethingHere { get; set; }
}
class MainBody : IMainBody // Error CS0738 'MainBody' does not implement interface member 'IMainBody.subProperty'. 'MainBody.subProperty' cannot implement 'IMainBody.subProperty' because it does not have the matching return type of 'ISubProperty'.
{
public SubProperty subProperty { get; set; }
}
class SubProperty : ISubProperty
{
public string somethingHere { get; set; }
}
Код: Выделить всё
interface IMainBody
where T : ISubProperty
{
T subProperty { get; set; }
}
interface ISubProperty
{
string somethingHere { get; set; }
}
Любой знаете какие-нибудь другие обходные пути?
Подробнее здесь: https://stackoverflow.com/questions/706 ... e-property
Мобильная версия