I got into a discussion a while back on why certain acad .net api functions want an input param of type IEnumerable.
I ran accross this thread at:
http://stackoverflow.com/questions/380819/common-programming-mistakes-for-net-developers-to-avoid
which mentions this:
[from that site]
Oh, I forgot my number one pet peeve, over specification of input parameters. Let's say we have a method that takes a
collection of some type, always allow the least specific type of collection needed by the method.
This is what you see A LOT:
public void Foo(List bars) { foreach(var b in bars) { // do something with the bar... }}As you see the method
does nothing but loops through the list, so requiring a list is an over specification, all you need is something you can
loop through, ie. an IEnumerable.
This is a lot nicer to the caller:
public void Foo(IEnumerable bars) ...If the method requires to know the count of the bars collection use
ICollection instead, or maybe you need to access bars by index, then use IList but always the least specific
sub type needed.
[/from that site]
So the point was to allow any collection of type Bar as an argument, a very nice thing indeed.
James Maeding
Civil Engineer and Programmer
jmaeding - at - hunsaker - dotcom