ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Core.Data Namespace / Row Class / Delete Method
Example

In This Topic
    Delete Method (Row)
    In This Topic
    Deletes the row. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    Public Sub Delete() 
    public void Delete()
    Exceptions
    ExceptionDescription
    This table/feature does not support this operation. For example, it is from a joined table.
    A geodatabase-related exception has occurred.
    Remarks
    Once delete is called on a Row, all subsequent queries against the table within the same session with this API will reflect the deleted state.
    Example
    Deleting a Row/Feature
    {
      await QueuedTask.Run(() =>
      {
        string message = String.Empty;
        bool deletionResult = false;
    
        using (Geodatabase geodatabase = new Geodatabase(new DatabaseConnectionFile(new Uri("path\\to\\sde\\file\\sdefile.sde"))))
        using (Table enterpriseTable = geodatabase.OpenDataset<Table>("LocalGovernment.GDB.piCIPCost"))
        {
          EditOperation editOperation = new EditOperation();
          editOperation.Callback(context =>
          {
            QueryFilter openCutFilter = new QueryFilter { WhereClause = "ACTION = 'Open Cut'" };
    
            using (RowCursor rowCursor = enterpriseTable.Search(openCutFilter, false))
            {
              while (rowCursor.MoveNext())
              {
                using (Row row = rowCursor.Current)
                {
                  // In order to update the Map and/or the attribute table. Has to be called before the delete.
                  context.Invalidate(row);
    
                  row.Delete();
                }
              }
            }
          }, enterpriseTable);
    
          try
          {
            deletionResult = editOperation.Execute();
            if (!deletionResult) message = editOperation.ErrorMessage;
          }
          catch (GeodatabaseException exObj)
          {
            message = exObj.Message;
          }
        }
    
        if (!string.IsNullOrEmpty(message))
          Debug.WriteLine(message);
      });
    }
    Requirements

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

    ArcGIS Pro version: 3.0 or higher.
    See Also