I have two different collections like below
public class Student
{
public int StudentID { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
}
public class Skills
{
public int SkillID { get; set; }
public int StudentID { get; set; }
public string Keyskill_Name { get; set; }
public int LastUsedYear { get; set; }
}
Here one student can contain multiple keyskils
I just want to fill a new collection like below
public class StudentDetails
{
public int StudentID { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public list<string> Keyskill_Name { get; set; }
}
Please help me. Thanks in advance.
The
GroupJoinLINQ method is the perfect solution for this case:How to use the
GroupJoinmethod?Student, there is one and only one correspondingStudentDetails.students) and its corresponding elements in the second set that have been found using the collision.