Why would I ever use a generic method when I can just pass in an interface parameter.
Here is an example that uses a generic method:
internal T DoSomething<T>(T value) where T : IDoIt
Here is an example that uses an interface:
internal IDoIt DoSomething(IDoIt value)
It seems to me that generics are only useful for basic types and for when an interface is not available. When would a programmer want to use one of the examples above instead of another ? Why use the generic method with the IDoIt constraint when he can just use an IDoIt parameter?
When is it better to use the generic method, and when is it better to use an interface parameter? Where would a generic parameter in a method be a better choice than an interface parameter in the method, and vice versa? For example, I can imagine a Strategy design pattern using either.