Если у меня есть группа DependencyProperties:
public UIElement Button0
{
get { return (UIElement)GetValue(Button1Property); }
set { SetValue(Button1Property, value); }
}
public static DependencyProperty Button1Property =
DependencyProperty.Register(nameof(Button1), typeof(UIElement), typeof(myClass), new PropertyMetadata(null));
public UIElement Button1....
public UIElement Button2....
...
Есть ли способ создать наблюдаемую коллекцию этих свойств, такую, что
AllButtons[0] = new Button(); //actually does: SetValue(Button0Property, value);
var button = AllButtons[1]; // actually does button = (UIElement)GetValue(Button1Property);
Я боролся с этим некоторое время и надеялся, что новые ref возвращаемые значения в C # 7.0 сделают это легко, но все же я снова нажал кирпичная стена. Разве в C # нет способа составить список указателей на свойства?