Usually I Use interfaces or base classes as paramter types when passing derived objects to a method. For example
Method1(ICar car);
Method2(BaseClass derivedClass);
But what about a Generic base class when the descendant class isn't generic ?
public class GenericBaseClass<T> where T : BaseClass
{}
public class GenericDerivedClass1 : GenericBaseClass<DerivedClass1>
{}
I can write something like
Method3(GenericBaseClass<BaseClass> class);
but I can't pass to this method am object of type GenericDerivedClass1
.
Is there any way how to pass my descendant class to this method ?