You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After verifying the accuracy of changes made to the object, you can accept the changes using the AcceptChanges method of the object, which will set the Current field values to be the Original values. The RejectChanges method rejects all changes made to the object since AcceptChanges was last called.
AcceptRejectChanges.cs
usingSystem;usingNUnit.Framework;usingBLToolkit.EditableObjects;namespaceHowTo.EditableObjects{[TestFixture]publicclassAcceptRejectChanges{publicabstractclassTestObject:EditableObject<TestObject>{publicabstractstringFirstName{get;set;}publicabstractstringLastName{get;set;}}[Test]publicvoidTest(){// Create an instance.//TestObjectobj=TestObject.CreateInstance();// Accept changes.//obj.FirstName="Tester";obj.LastName="Testerson";Assert.IsTrue(obj.IsDirty);obj.AcceptChanges();Assert.AreEqual("Tester",obj.FirstName);Assert.IsFalse(obj.IsDirty);// Reject changes.//obj.FirstName="Developer";Assert.IsTrue(obj.IsDirty);obj.RejectChanges();Assert.AreEqual("Tester",obj.FirstName);Assert.IsFalse(obj.IsDirty);}}}