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
Cracker
Cracker3y ago
you want to merge newMappings and mappings.Where()'s result right ?
TheBoxyBear
TheBoxyBearOP3y ago
Yes, essentially ttaking all mappings and replace the ones for a given difficulty Order doesn't matter
Cracker
Cracker3y ago
okay so its not actually adding another collection to list change the property of existing items in the list
TheBoxyBear
TheBoxyBearOP3y ago
It's not a list, all defined as IEnumerable<>
Cracker
Cracker3y ago
for that you can use .Select() or go foreach on items and change the values I considered IEnumerable as List
TheBoxyBear
TheBoxyBearOP3y ago
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
Cracker
Cracker3y ago
var result = mappings.Where(m => m.Difficulty != Content.Difficulty).ForEach(x=>x.Difficulty = newDifficulty); thought like this
TheBoxyBear
TheBoxyBearOP3y ago
The difficulty doesn't change, it's just an identifier to group items Found it, it's just newMappings is a subtle different type
Want results from more Discord servers?
Add your server