Imagine I have this class:
Class Foo
{
public Bar b1 { get; set; }
public Bar b2 { get; set; }
public Bar b3 { get; set; }
public void UpdateBarsMyProp(bool value)
{
// ????
}
}
Class Bar
{
public bool MyProp { get; set; }
public bool UpdateMyProp(bool value)
{
this.MyProp = value;
}
}
What's the best way to update the property MyProp in b1, b2 and b3?
Generics?
Delegates?
EDIT:
Just to add more information about my specific situation:
I'm creating a virtual keyboard and I'm using WPF MVVM so I have:
A KeyBoard ViewModel which contains several Key ViewModels, I can't store them in a List because im my View (xaml file) I need to bind each key information to a specific ViewModel.
Now, when the user presses the virtual shift button, I need my Keyboard ViewModel object to update the display char in every Key ViewModel.