If I write a method accepting a parameter which derives from a BaseClass
(or an interface), as far as I know there are two ways to achieve that:
voi
In the examples included in your question, there isn't much difference between the generic and the non-generic version. But here are some other examples of method signatures that can't be expressed without generics:
T MyMethod(T obj) where T : BaseClass { ... }
void MyMethod(T obj1, T obj2) where T : BaseClass { ... }
void MyMethod(T obj, List list) where T : BaseClass { ... }