Recommendation 97: Prioritize the delivery of a base type or interface as a parameter
In addition to the disclosure and type or interface, the parameters of the method should also take into account the base type or interface.
In the case of the enumerable type, the IEnumerable generic interface is used in its member methods whenever it involves the need to manipulate the collection object, such as:
Public Static Ienumerable<tsource> take<tsource> (thisint count) { if Null) { throw error.argumentnull ("source" ) ); } return Takeiterator<tsource>(source, count);}
This method is used to get a subset of the specified number of collections. That's because of the way this extension exists. We can take operations on all generic collections.
Turn from: 157 recommendations for writing high-quality code to improve C # programs Minjia
Go to write high-quality Code 157 recommendations for improving C # Programs--Recommendation 97: Prioritize the delivery of base types or interfaces as parameters