public void changeProperties(string propertyName, object newValue)
var prop = GetType().GetProperty(propertyName);
throw new NullReferenceException("Property doesn't exist!");
prop.SetValue(this, newValue);
public class Test : baseclass
public int Age { get; set; }
public static void Main()
test.changeProperties("Age", 2);
Console.WriteLine(test.Age);