❔ query all items that match both properties.
I have a list of tuples as:
And I want to retrieve all items that match the int to score and string to PlayerName.
How can I do that using LINQ?
I don't want all the possible combinations of pair values.
13 Replies
its unclear what you want. Do you have an instance of
MyCollectionItem
and want to see if it matches one of your tuples?
or do you want to map your tuples into MyCollectionItem
s?Just use a
.Where()
or y'know, ask a question then immediately go offline 😄
A, a cult classic in this server at this point lmao
I have a List of MyCoĺectionItem and I want to retrieve all of these that match a tuple from the other List
Convert the list of tuples to list of MyCollectionItems with
.Select()
, then .Intersect()
Alternatively, .Where()
with a .Contains()
inside
But it'll prolly be less performant
Ah, there's also .IntersectBy()
Seems to be just what you needCannot convert them, for simplicity I removed other properties. The MyCollectionItem has a lot of other properties, but I need to match only on these two
.IntersectBy()
thengo with
IntersectBy
thenOkay, thanks
Just read about FROM, WHERE, SELECT, INTERSECTBY clause and how to use it to manipulate data, almost the same thing if you know about database
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.