Reporter | Jakub Jiricek (jakub.jiricek@vodafone.com) |
---|---|
Created | Jan 27, 2012 4:06:36 PM |
Updated | Jan 27, 2012 4:06:36 PM |
Priority | Normal |
Type | Bug |
Fix versions | No Fix versions |
State | Submitted |
Assignee | Unassigned |
Subsystem | Code Analysis |
Affected versions | 6.1.1 |
Fixed in build | No Fixed in build |
in the code
R# correctly warns about possible multiple enumeration of _paramAllocs (within checkAlloc method)
but the warning does not appear when the code is rewritten as
private static bool checkStartBlock(IEnumerable<mux_trunk_allocationSpecialEDR> _paramAllocs, short capacity) { for (short ts = 1; ts <= capacity; ts ++) if (!checkAlloc(_paramAllocs, ts)) return false; return true; }
R# correctly warns about possible multiple enumeration of _paramAllocs (within checkAlloc method)
but the warning does not appear when the code is rewritten as
private static bool checkStartBlock(IEnumerable<mux_trunk_allocationSpecialEDR> _paramAllocs, short capacity) { List<short> tsList = new List<short>(); for (short ts = 1; ts <= capacity; ts++) tsList.Add(ts); return tsList.All(ts => checkAlloc(_paramAllocs, ts)); }