ArcGIS Pro 2.9 API Reference Guide
CreateChainedOperation Method
Example 

ArcGIS.Desktop.Editing Namespace > EditOperation Class : CreateChainedOperation Method
Creates a follow-on operation which will be shared with this operation on the application's undo stack.
Syntax
public EditOperation CreateChainedOperation()
Public Function CreateChainedOperation() As EditOperation

Return Value

a newly created EditOperation that will be merged with this one.
Example
//Chaining operations is a special case. Use "Chained Operations" when you require multiple transactions 
//to be undo-able with a single "Undo".

//The most common use case for operation chaining is creating a feature with an attachement. 
//Adding an attachment requires the object id (of a new feature) has already been created. 
var editOperation1 = new EditOperation();
editOperation1.Name = string.Format("Create point in '{0}'", CurrentTemplate.Layer.Name);

long newFeatureID = -1;
//The Create operation has to execute so we can get an object_id
editOperation1.Create(this.CurrentTemplate, polygon, (object_id) => newFeatureID = object_id);
//Must be within a QueuedTask
editOperation1.Execute();

//or use async flavor
//await editOperation1.ExecuteAsync();

//Now, because we have the object id, we can add the attachment.  As we are chaining it, adding the attachment 
//can be undone as part of the "Undo Create" operation. In other words, only one undo operation will show on the 
//Pro UI and not two.
var editOperation2 = editOperation1.CreateChainedOperation();
//Add the attachement using the new feature id
editOperation2.AddAttachment(this.CurrentTemplate.Layer, newFeatureID, @"C:\data\images\Hydrant.jpg");

//editOperation1 and editOperation2 show up as a single Undo operation on the UI even though
//we had two transactions
//Must be within a QueuedTask
editOperation2.Execute();

//or use async flavor
//await editOperation2.ExecuteAsync();
Requirements

Target Platforms: Windows 11, Windows 10, Windows 8.1

See Also

Reference

EditOperation Class
EditOperation Members