Linq To Objects Outer Join?

Thanks @Jdidu, worked perfectly – Ben Mar 10 '10 at 17:19.

Try this example. Edit: Oops missed the vb. Net requirement, sorry.

Try this answer to a similar question. Edit of the Edit (I'm on a roll) Posted a link to the wrong answer, but same question. The vb.Net answer is here.

I have seen this (excellent website), but as stated in the question, I am aware that this is possible in C# (as per the code in your link), but I cant get it to work in VB.Net. – Ben Mar 10 '10 at 17:09 @Ben - sorry, I did miss that in the first pass. I've updated the answer with a vb.Net based link.

Sorry about that. – Mike Two Mar 10 '10 at 17:11 @Ben, did it again, posted the wrong link. I'm fixing it.

Just not my night. – Mike Two Mar 10 '10 at 17:12 No problem, we've all had those days. Thanks for the link, worked perfectly, @Jdidu got there a bit quicker though.

– Ben Mar 10 '10 at 17:19 @Ben - You're welcome. You could still upvote even if you don't accept it :) – Mike Two Mar 10 '10 at 17:33.

This will compile to the exact same code as the example above, except that the parameter named "groupJoinItem" in the SelectMany will be named something like "temp0" because that parameter doesn't explicitly exist in the comprehension version of this code. I think you can appreciate how much simpler this version of the code is. I always use this syntax when doing a left outer join.

I never use GroupJoin with SelectMany. However, at first glance it makes very little sense. A join followed by an into creates a GroupJoin.

You first have to know this, and why you'd want this. Then the second from indicates a SelectMany, which is non-obvious. When you have two from keywords you are effectively creating a cross join (cartesian product), which is what SelectMany is doing.

It's a basic cross join. So, back to our original left join LINQ query: The first from of the query is the group join, and the second from expresses a cross join between each groupJoinItem and its own collection of matching right letters. In fact, we could actually write it as such!

That selectMany expresses the following: "for each item in groupJoin, cross join it with its own MatchingRightLetters property, and concatenate all of the results together." This gives the exact same result as any of our left join code above. That's probably way too much of an explanation for this simple question, but I dislike cargo cult programming (google it).

You should know exactly what your code is doing, and why, or else you won't be able to tackle more difficult problems.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions