Linq Concat not defined?
var result = mappings.Where(m => m.Difficulty != Content.Difficulty).Concat(newMappings);
I have Linq in my usings and setting result to only Where compiles but when I append Concat, it's saying IEnumerable<> has no definition for Concat. The types of mappings and newMappints are the same and I get recommended Concat when I type it.8 Replies
you want to merge newMappings and mappings.Where()'s result right ?
Yes, essentially ttaking all mappings and replace the ones for a given difficulty
Order doesn't matter
okay so its not actually adding another collection to list
change the property of existing items in the list
It's not a list, all defined as IEnumerable<>
for that you can use .Select() or go foreach on items and change the values
I considered IEnumerable as List
Just forming an expression so it can be resolved and processed somewhere else
Just wondering why concat doesn't work
It's not collections in memory, just the returns of iterator methods
var result = mappings.Where(m => m.Difficulty != Content.Difficulty).ForEach(x=>x.Difficulty = newDifficulty);
thought like this
The difficulty doesn't change, it's just an identifier to group items
Found it, it's just newMappings is a subtle different type