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
atakancracker
atakancracker2y ago
you want to merge newMappings and mappings.Where()'s result right ?
TheBoxyBear
TheBoxyBear2y ago
Yes, essentially ttaking all mappings and replace the ones for a given difficulty Order doesn't matter
atakancracker
atakancracker2y ago
okay so its not actually adding another collection to list change the property of existing items in the list
TheBoxyBear
TheBoxyBear2y ago
It's not a list, all defined as IEnumerable<>
atakancracker
atakancracker2y ago
for that you can use .Select() or go foreach on items and change the values I considered IEnumerable as List
TheBoxyBear
TheBoxyBear2y 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
atakancracker
atakancracker2y ago
var result = mappings.Where(m => m.Difficulty != Content.Difficulty).ForEach(x=>x.Difficulty = newDifficulty); thought like this
TheBoxyBear
TheBoxyBear2y 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
More Posts