DEV Community

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

Collapse
 
neil445 profile image
neil445
  1. They mean an array.
  2. They just wanted to get rid of warnings from Resharper, and to make sure we aren't doing that multiple enumeration.
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")