All T can be A ... but not all A are T.
When you create a type that comes from A and passes it to a generic method, the compiler knows it as T, a derived type. If you do not return it, it does not know that you want A or T or any type of inheritance tree between T and A.
This logic applies whether you use generics or not.
public class A {} public class B : A {} public class C: B {} A animal = new C(); C cat = animal;
Although you have a general restriction, this usually applies to the way you use the general method and prevents violation of the restriction. It does not apply to any link of a derived type through a base link. Although the compiler "may" understand this, it may not know that this was your intention, so it is better to be safe and not do it.
source share