Hi i want to cast the Parent object to Child object in C#
public class Parent
{
public string FirstName {get; set;}
public string LastName {get; set;}
public string City {get; set;}
}
public class Child : Parent
{
public string PhoneNumber {get; set;}
public string MobileNumber {get; set;}
}
now the scenario is is a list of parent object and i want to generate list of child object so that i can have extended information
List<Parent> lstParent;
List<Child> lstChild = new List<Child>();
foreach(var obj in lstParent)
{
lstChild.add((Child)obj);
}
as child class inherited parent class so the child class already have the parent class member i just want to fill them automatically so that i can populate datamember of child class