Как я могу использовать ElementRef вместо document.getElementById для получения nodeList

Метод ниже подходит для меня:

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;
0
задан PrakashG 31 December 2018 в 12:52
поделиться