DEV Community

Discussion on: I got called out for using IEnumerable on methods

Collapse
 
rmurray0809 profile image
Rmurray0809

I can actually see some logic in the "lightest Implementation" argument. While you might be passing around an IEnumerable backed by a List there isn't anything to prevent someone from choosing something completely at random like a BlockingCollection or SortedSet. Those could have significant performance penalties and would be obfuscated by the fact that everyone trying to find the bottleneck is just seeing an IEnumerable. (I can hear it already, "but the function needs to be threadsafe")