Is there a generic way similar to memento pattern to make a copy of windows forms application Settings.Default.PropertyValues? I need to check if specific property values are changed.
object state = CreateMemento(Settings.Default.PropertyValues);
// show windows dialog where properties may change and be saved
SettingsPropertyValueCollection settings = GetMemento(state);
if (IsSomePropertyChanged(settings, Settings.Default.PropertyValues);
DoSomeAction();
The relevant design pattern is probably Decorator (you are adding functionality while retaining the interface) or Proxy (an object is acting as a a stand-in for another object while maintaining its interface)
You need to either somehow proxy the Settings.Default.PropertyValues with another object that looks for the setting to be changed and delegates all changes to the original object. Whether that can be done system-wide, or you have to do so manually so all your code has to use myProxyForSettings.Default.PropertyValues I don’t know.