public void Undo() { Type elementType = ElementActedOn.GetType(); PropertyInfo property = elementType.GetProperty(PropertyActedOn); property.SetValue(ElementActedOn, PreviousState, null); }
public void Undo() { if (ElementActedOn == null) { return; } Type elementType = ElementActedOn.GetType(); PropertyInfo?propertyInfo = elementType.GetProperty(PropertyActedOn); if (propertyInfo == null) { return; } propertyInfo.SetValue(ElementActedOn, PreviousState, null); }