|
|
|
|
|
by davidgay
430 days ago
|
|
I'm of the opinion that var ageLookup = new Dictionary<AgeRange, List<Member>>();
foreach (var member in members) {
ageLookup.getOrCreate(member.AgeRange, List::new).add(member);
}
is more readable in the long-term... (less predefined methods/concepts to learn). |
|
Readability incorporates familiarity but also conciseness. I suppose it depends what else is going on in the codebase. I have a database access class in one of my solutions where `ToLookup` is used 15 times; yes you have to learn the concept, but it's an inbuilt method and it's a massive benefit once you grok it.