Idiomatic LINQ way to access both object and an object's property? [Answered]
I'd like to do this with LINQ. Normally I would use
.Select()
, but if the inner operation needs both an object (item
) and an inner property (thing
), I don't know of a clean way to do it. I can .Select()
into a tuple containing both items, but this is really ugly. Any idea?7 Replies
IIRC SelectMany has a ResultSelector, can you access the parent there?
i see - let me try that
SharpLab
C#/VB/F# compiler playground.
in your case:
that does look like pretty much it - awesome!
thanks very much
š
You're welcome ^^
ā
This post has been marked as answered!