public static void Main()
var address = new Address("1 Town St", "Barchester", "UK");
Console.WriteLine($"This is value Address1: {address["Address1"]}");
public Address(string address1, string address2, string country)
public string Address1 { get; set; }
public string Address2 { get; set; }
public string Country { get; set; }
public object this[string propertyName]
get { return this.GetType().GetProperty(propertyName).GetValue(this, null); }
set { this.GetType().GetProperty(propertyName).SetValue(this, value, null); }