ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Desktop.Editing Namespace / EditOperation Class / IsEmpty Property
Example

In This Topic
    IsEmpty Property (EditOperation)
    In This Topic
    Gets a value indicating if the EditOperation is empty.
    Syntax
    Public ReadOnly Property IsEmpty As Boolean
    public bool IsEmpty {get;}

    Property Value

    true if the EditOperation has no methods set before executing.
    Remarks
    This is used internally before executing the operation to test if any methods have been set.
    Example
    Edit Operation - check for actions before Execute
    // Checks for pending actions in an edit operation before attempting to execute it.
    await QueuedTask.Run(() =>
    {
      // Create an edit operation
      var op = new EditOperation() { Name = "My Edit Operation" };
      // Add some actions to the edit operation
      op.Modify(featureLayer, objectId, geometry);
      // EditOperation.Modify can unknowingly set an attribute to the already existing value
      // In this scenario the Modify action will detect that no changes are required and consequently the Execute operation will fail.
      // To avoid this, we can check if the edit operation is empty before executing it.
      if (!op.IsEmpty)
      {
        // Execute the edit operation
        var result = op.Execute();
        Debug.WriteLine($"Edit operation executed successfully: {result}");
      }
      else
      {
        Debug.WriteLine("No actions to execute in the edit operation.");
      }
    });
    Requirements

    Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)

    ArcGIS Pro version: 3.0 or higher.
    See Also