YetAnohterOne
YetAnohterOne
CC#
Created by YetAnohterOne on 2/13/2025 in #help
Can I / should I enumerate over an IGrouping more than once?
Assume that, inside the loop, I do not mutate myList or any of its contents?
16 replies
CC#
Created by YetAnohterOne on 2/13/2025 in #help
Can I / should I enumerate over an IGrouping more than once?
?
16 replies
CC#
Created by YetAnohterOne on 2/13/2025 in #help
Can I / should I enumerate over an IGrouping more than once?
you mean something like
var groupings = myList.GroupBy(listElement => listElement.Key);
var groupingsSafe = groupings.ToDictionary(g => g.Key, g => g.ToList());
foreach(var groupoing in groupingsSafe)
{
...
}
var groupings = myList.GroupBy(listElement => listElement.Key);
var groupingsSafe = groupings.ToDictionary(g => g.Key, g => g.ToList());
foreach(var groupoing in groupingsSafe)
{
...
}
16 replies
CC#
Created by YetAnohterOne on 2/6/2025 in #help
CA1860: Avoid using 'Enumerable.Any()' extension method
I wish you score par every time! 🙂 🙂 🙂
59 replies