I refer to the Examples in How to: Combin Data with Linq by using joins. We have two Lists the first holds person objects (First- and Lastname). The second List holds Pet objects (Name) that holds a person object (pet owner). One Person can own >= 0 pets.
What happend now is I performed the group join
Dim result1 = From pers in people
Group Join pet in pets
on pers Equals pet.Owner
Into PetList = Group
LinqPad shows me the result:
This looks to me like Linq is producing a lot of redundancies (but I might be wrong here!). The first result object would hold the person object three times. Two questions arises here for me as a Linq nooby (but maybe I read the output not the right way):
Select pers.FirstName , pers.LastName, PetName = If(pet is Nothing, String.Empty, pet.Name)
If we have all information about the Person Object in the PetList, why not just query this object? In my opinion we dont need the pers Object anymore.
Yes, those Person objects are references. LINQ is not cloning Person objects.
The reason for that output is that LINQPad is trying to show you who that person is. Without repeating a walk of its properties and fields, it would be hard to tell what person it was referring to.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With