ArcGIS Pro 3.8 API Reference Guide
ArcGIS.Desktop.Editing Namespace / EditOperation Class / Modify Method / Modify(Row,Int32,Object) Method
The row to update.
The field index to update.
The new value.
Example

In This Topic
    Modify(Row,Int32,Object) Method
    In This Topic
    Modify a row, updating the attribute values. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    public void Modify( 
       Row row,
       int fieldIndex,
       object value
    )
    Public Overloads Sub Modify( _
       ByVal row As Row, _
       ByVal fieldIndex As Integer, _
       ByVal value As Object _
    ) 

    Parameters

    row
    The row to update.
    fieldIndex
    The field index to update.
    value
    The new value.
    Exceptions
    ExceptionDescription
    This method or property must be called within the lambda passed to QueuedTask.Run.
    Example
    Order edits sequentially
    // Modifies the "NAME" attribute of a specified feature and then splits the feature using the provided polyline, all within a single sequential edit operation.
    // perform an edit and then a split as one operation.
    await QueuedTask.Run(() =>
     {
       var newName = "Modified then Split";
       var queryFilter = new QueryFilter() { WhereClause = "OBJECTID = " + objectId.ToString() };
    
       // create an edit operation and name.
       var op = new EditOperation
       {
         Name = "modify followed by split",         // set the ExecuteMode
         ExecuteMode = ExecuteModeType.Sequential
       };
       using (var rowCursor = layer.Search(queryFilter))
       {
         while (rowCursor.MoveNext())
         {
           using var feature = rowCursor.Current as ArcGIS.Core.Data.Feature;
           op.Modify(feature, "NAME", newName);
         }
       }
       op.Split(layer, objectId, splitLine);
       if (!op.IsEmpty)
       {
         bool result = op.Execute();
       }
       // else
       //  The operation doesn't make any changes to the database so if executed it will fail
     });
    Read and Write blob fields with the attribute inspector
    await QueuedTask.Run(() =>
    {
      // get selected feature into inspector
      var selectedFeatures = activeMap.GetSelection();
      var insp = new Inspector();
      insp.Load(selectedFeatures.ToDictionary().Keys.First(), selectedFeatures.ToDictionary().Values.First());
      // read a blob field and save to a file
      var msw = new MemoryStream();
      msw = insp["BlobField"] as MemoryStream;
      using (FileStream file = new(@"d:\temp\blob.jpg", FileMode.Create, FileAccess.Write))
      {
        msw.WriteTo(file);
      }
      // read file into memory stream
      var msr = new MemoryStream();
      using (FileStream file = new(@"d:\images\Hydrant.jpg", FileMode.Open, FileAccess.Read))
      {
        file.CopyTo(msr);
      }
      //put the memory stream in the blob field and save to feature
      var op = new EditOperation() { Name = "Blob Inspector" };
      insp["Blobfield"] = msr;
      op.Modify(insp);
      if (!op.IsEmpty)
      {
        var result = op.Execute(); //Execute and ExecuteAsync will return true if the operation was successful and false if not
      }
    });
    Write a compressed image to a raster field
    var compressedRasterMapView = MapView.Active;
    if (compressedRasterMapView == null)
      return;
    
    await QueuedTask.Run(() =>
    {
      //Open the raster dataset on disk and create a compressed raster value dataset object
      var dataStore = new ArcGIS.Core.Data.FileSystemDatastore(new ArcGIS.Core.Data.FileSystemConnectionPath(new Uri(@"e:\temp"), ArcGIS.Core.Data.FileSystemDatastoreType.Raster));
      using (var fileRasterDataset = dataStore.OpenDataset<ArcGIS.Core.Data.Raster.RasterDataset>("Hydrant.jpg"))
      {
        var storageDef = new ArcGIS.Core.Data.Raster.RasterStorageDef();
        storageDef.SetCompressionType(ArcGIS.Core.Data.Raster.RasterCompressionType.JPEG);
        storageDef.SetCompressionQuality(90);
    
        var rv = new ArcGIS.Core.Data.Raster.RasterValue();
        rv.SetRasterDataset(fileRasterDataset);
        rv.SetRasterStorageDef(storageDef);
    
        var sel = compressedRasterMapView.Map.GetSelection();
    
        //insert a raster value object into the raster field
        var insp = new ArcGIS.Desktop.Editing.Attributes.Inspector();
        insp.Load(sel.ToDictionary().Keys.First(), sel.ToDictionary().Values.First());
        insp["Photo"] = rv;
    
        var op = new EditOperation() { Name = "Raster Inspector" };
        op.Modify(insp);
        if (!op.IsEmpty)
        {
          var result = op.Execute(); //Execute and ExecuteAsync will return true if the operation was successful and false if not
        }
      }
    });
    Requirements

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

    ArcGIS Pro version: 3.0 or higher.
    See Also