i have model class look like
public class Student
{
public string student_id{ get; set; }
public string student_name{ get; set; }
public string father_name{ get; set; }
}
public class StudentStatus
{
public string student_id{ get; set; }
public string session{ get; set; }
public string status{ get; set; }
}
public class FinalList
{
public string student_id{ get; set; }
public string student_name{ get; set; }
public string father_name{ get; set; }
public string session{ get; set; }
public string status{ get; set; }
}
and i have two List also
List<Student> std1=new List<Student>()
{
new Student{student_id="1",student_name="test1",father_name="father1"},
new Student{student_id="2",student_name="test2",father_name="father2"}
}
List<StudentStatus> std2=new List<StudentStatus>()
{
new Student{student_id="1",session="2021",status="Active"},
new Student{student_id="2",session="2022",status="InActive"}
}
now i want to merge the data of this two List into 3rd List. and my final list should be look like this:
List<FinalList> finallist=new List<FinalList>()
{
new Student{student_id="1",student_name="test1",father_name="father1",session="2021",status="Active"},
new Student{student_id="2",student_name="test2",father_name="father2",session="2022",status="InActive"}
}
any one suggest me the solution
What I have tried:
i google it but only find solution for string or int type list not classobject type list like this
1. firstList.AddRange (secondList);
2. var combined = list1.Concat(list2);
this solution does not work in my case