I have the following C# classes
public class BaseRow
{ }
public class BaseCollection<T> where T : BaseRow
{ }
public class ClientBaseClass<T> where T : BaseCollection<BaseRow>
{ }
public class ActualRow : BaseRow
{ }
public class ActualCollection : BaseCollection<ActualRow>
{ }
public class ActualClientClass : ClientBaseClass<ActualCollection>
{ }
In compilation of ActualClientClass, the compiler fails saying something like
ActualCollection must be convertible to BaseCollection <BaseRow> in order to use it as parameter T in the generic class.
I am not sure I understand this, as ActualCollection
inherits from BaseCollection<ActualRow>
where ActualRow
inherits from BaseRow
. I am having a hard time finding a similar case on the web.
Is this possible at all or do I need to re-define my architecture?