Sparky Mark (sparkymark) wrote in csharp,
Sparky Mark

LINQ beginner

I have a pair of LINQ "group" statements, each outputs a IEnumerable<IGrouping<bool,int>>. Call these results a and b. I want to create four collections of ints, The ones that correspond to "a.Key && b.Key", "a.Key && !b.Key", "!a.Key && b.Key", "!a.Key && !b.Key".

I can convert a and b to Dictionaries with the ToDictionary extension method and have code like...

var foo = from aa in aMap[true] join bb in bMap[true] on aa equals bb select aa;

...but then I need to check the dictionary keys exists, which is not a huge overhead but I can't help thinking there must be some way of "join"ing a and b directly...?
  • Post a new comment


    default userpic
    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.