I have a list
List<Student>
class Student{
public string FirstName { get; set; }
public string LastName { get; set; }
public string School { get; set; }
}
I want to use above list and create or fill that data into
List<Person>
class Person{
public string FirstName { get; set; }
public string LastName { get; set; }
}
Help me..
Thanx
That should do the trick
List<Person> persons = students.Select(student => new Person {FirstName = student.FirstName, LastName = student.LastName}).ToList();
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