Reporter | Yuri Astrakhan (yurik) |
---|---|
Created | Apr 20, 2012 10:22:48 PM |
Updated | Apr 20, 2012 10:22:48 PM |
Priority | Normal |
Type | Bug |
Fix versions | No Fix versions |
State | Submitted |
Assignee | Unassigned |
Subsystem | No subsystem |
Affected versions | 7.0 Preview |
Fixed in build | No Fixed in build |
Just like IEnumerable.Where(predicate).Last() should be optimized to IEnumerable.Last(predicate), Sum() and other methods that include selectors should be optimized:
The example above is slightly more complex than a straightforward conversion because int.Parse() cannot be used directly and must be used as lambda expression.
static int Sum(IEnumerable<string> vals) { return vals.Select(int.Parse).Sum(); // Should be converted to: vals.Sum(i => int.Parse(i)); }
The example above is slightly more complex than a straightforward conversion because int.Parse() cannot be used directly and must be used as lambda expression.