I have a result set which i get back from executing the stored procedure I am working with. Here is what the result set looks like for example:
var staff = new Staff[]
{
new Staff{Code = 5, Name = "Sam", Team = "AB1"},
new Staff{Code = 6, Name = "Dave", Team="RAB"},
new Staff{Code = 6, Name = "Dave", Team="ABC"},
};
A Staff member can operate in more than one team according to the data set i am dealing with.
What i want to do is group them in order to show the results like this:
Value ChildValues
Dave [RAB, ABC]
Sam [AB1]
How can i achieve this? I have tried the following by duplicate the primary list but i know the below is incorrect:
var query = staff.GroupJoin(staff, s => s.Code,
s => s.Code, (s, result) => new StaffResult(s.Name, result));
I appreciate the assistance regarding the above.