If I wanted to create a method that takes an instance of IList
as a parameter (or any other interface, but let\'s use IList
as an example), I could cre
Reagrding your example I would prefer the second approach. Generic methods or classes are mostly used when the caller can use them with more than on type as in your example. In this case you can avoid a base class (e.g. object
) as return value and provide type safe return values.
On simple sample
public class Foo
{
public T GetSomething()
{
return default(T);
}
}