I'm building a mapping engine.
The "path" will be coming in as a string, it is shown here as mappingAddress. The value in theAddressTypeValue is what needs to be populated the already instantiated object 2 levels deep in employee.
How do I update "TheAddressType" in the 2 levels deep of the "employee"
Thanks!
class Program
{
static void Main(string[] args)
{
string mappingAddress = "EmployeeAddress.ChildAddressType.TheAddressType";
string theAddressTypeValue = "A Home";
Employee employee = new Employee();
//Magic code here
}
}
public class Employee
{
public Employee()
{
EmployeeAddress = new Address();
}
public Address EmployeeAddress { get; set; }
}
public class Address
{
public Address()
{
ChildAddressType = new AddressType();
}
public AddressType ChildAddressType { get; set; }
}
public class AddressType
{
public string TheAdddressType { get; set; }
}