I had this code:
return children.SelectMany(c => GetChildControls<TControl>(c)).Concat(children);
...and Resharper suggested I change it to this:
return children.SelectMany(GetChildControls<TControl>).Concat(children);
In context:
internal static IEnumerable<TControl> GetChildControls<TControl>(this Control control) where TControl : Control
{
var children = control.Controls != null ? control.Controls.OfType<TControl>() : Enumerable.Empty<TControl>();
return children.SelectMany(GetChildControls<TControl>).Concat(children);
}
The difference, as you probably saw, is that the "improved" version of the line has ommitted the inserted "(c)"
But now it flags that as suspicious, saying, "Possible multiple enumeration of IEnumerable"
Yeah, that's right, there could/should be multiple, but why is it whin[g]ing about that? Should I revert it to its previous state?