Hello,
Can anyone tell me why this won't compile. I'm getting the error:
"The type 'GenericsTest.GenericType3' must be convertible to
'GenericsTest.GenericType2<GenericsTest.IInterface 2>' in order to use it as
parameter 'T' in the generic type or method 'GenericsTest.BaseCollection<T>"
However, GenericType3 clearly inherits from GenericType2<IInterface2>
************ Code *************
#region Interface Hierarchy
public interface IInterface1
{}
public interface IInterface2 : IInterface1
{}
public class InterfaceType : IInterface2
{}
#endregion Interface Hierarchy
#region Generic Hierarchy
public abstract class GenericType1<T1, T2>
{}
public class GenericType2<T> : GenericType1<long, T>
where T : IInterface2
{}
public class GenericType3 : GenericType2<InterfaceType>
{ }
#endregion Generic Hierarcy
#region Collection Hierarchy
public abstract class BaseCollection<T>
where T : GenericType2<IInterface2>
{}
public class Collection : BaseCollection<GenericType3>
{ }
#endregion Collection Hierarchy
************ End Code *************
Thanks in advance for any help you can provide.
Mike