Some time ago I've read something like a 'convention' for OOP, but I'm not sure if I remember it correctly.
It says that a method must take the most generic objects in inheritance hierarchy as parameters, while return the most descendant ones.
Is this true and if it is, can anybody explain a lil bit?
Example:
IList<T> someMethod(IList<T> someList)
{
IList<T> resultList = new List<T>();
... do something with resultList ...
return resultList;
}
According to the 'convention' the method above should return List, instead of IList?