Метод ниже подходит для меня:
class MyClass {
public string prop1 { set; get; }
public object this[string propertyName]
{
get { return this.GetType().GetProperty(propertyName).GetValue(this, null); }
set { this.GetType().GetProperty(propertyName).SetValue(this, value, null); }
}
}
Чтобы получить значение свойства:
MyClass t1 = new MyClass();
...
string value = t1["prop1].ToString();
Чтобы установить значение свойства:
t1["prop1] = value;