ArcGIS Pro 2.9 API Reference Guide
SetOnComitted Method
Example 

ArcGIS.Desktop.Editing Namespace > EditOperation Class : SetOnComitted Method
The action to take when this operation is committed, the argument specifies whether the edit was saved or discarded.
Sets an action that will be called when this editoperation is committed.
Syntax
public void SetOnComitted( 
   Action<bool> callback
)
Public Sub SetOnComitted( _
   ByVal callback As Action(Of Boolean) _
) 

Parameters

callback
The action to take when this operation is committed, the argument specifies whether the edit was saved or discarded.
Example
  // SetOnUndone, SetOnRedone and SetOnComittedManage can be used to manage 
  // external actions(such as writing to a log table) that are associated with 
  // each edit operation.

  //get selected feature and update attribute
  var selectedFeatures = MapView.Active.Map.GetSelection();
  var testInspector = new Inspector();
  testInspector.Load(selectedFeatures.Keys.First(), selectedFeatures.Values.First());
  testInspector["Name"] = "test";

  //create and execute the edit operation
  var updateTestField = new EditOperation();
  updateTestField.Name = "Update test field";
  updateTestField.Modify(insp);

  //actions for SetOn...
  updateTestField.SetOnUndone(() =>
  {
    //Sets an action that will be called when this operation is undone.
    Debug.WriteLine("Operation is undone");
  });

  updateTestField.SetOnRedone(() =>
  {
    //Sets an action that will be called when this editoperation is redone.
    Debug.WriteLine("Operation is redone");
  });

  updateTestField.SetOnComitted((bool b) => //called on edit session save(true)/discard(false).
  {
    // Sets an action that will be called when this editoperation is committed.
    Debug.WriteLine("Operation is committed");
  });

  updateTestField.Execute();

}
Requirements

Target Platforms: Windows 11, Windows 10, Windows 8.1

See Also

Reference

EditOperation Class
EditOperation Members