ArcGIS Pro 3.2 API Reference Guide
ArcGIS.Desktop.Editing.Attributes Namespace / Attribute Class
Members Example

In This Topic
    Attribute Class
    In This Topic
    Defines a single field and value (or composite of values) for the selected features.
    Object Model
    Attribute ClassDomain ClassSubtype ClassField ClassMapMember Class
    Syntax
    Remarks

    Example
    Get a layers schema using Inspector
    QueuedTask.Run(() =>
    {
      var firstFeatureLayer = MapView.Active.Map.GetLayersAsFlattenedList().OfType<ArcGIS.Desktop.Mapping.FeatureLayer>().FirstOrDefault();
    
      // create an instance of the inspector class
      var inspector = new ArcGIS.Desktop.Editing.Attributes.Inspector();
    
      // load the layer
      inspector.LoadSchema(firstFeatureLayer);
    
      // iterate through the attributes, looking at properties
      foreach (var attribute in inspector)
      {
        var fldName = attribute.FieldName;
        var fldAlias = attribute.FieldAlias;
        var fldType = attribute.FieldType;
        int idxFld = attribute.FieldIndex;
        var fld = attribute.GetField();
        var isNullable = attribute.IsNullable;
        var isEditable = attribute.IsEditable;
        var isVisible = attribute.IsVisible;
        var isSystemField = attribute.IsSystemField;
        var isGeometryField = attribute.IsGeometryField;
      }
    });
    Update Annotation Text via attribute. Caveat: The TEXTSTRING Anno attribute must exist
    //See "Change Annotation Text Graphic" for an alternative if TEXTSTRING is missing from the schema
    await QueuedTask.Run(() =>
    {
        //annoLayer is ~your~ Annotation layer...
    
        // use the inspector methodology
        var insp = new Inspector();
        insp.Load(annoLayer, oid);
    
        // make sure TextString attribute exists.
        //It is not guaranteed to be in the schema
        ArcGIS.Desktop.Editing.Attributes.Attribute att = insp.FirstOrDefault(a => a.FieldName == "TEXTSTRING");
        if (att != null)
        {
            insp["TEXTSTRING"] = "Hello World";
    
            //create and execute the edit operation
            EditOperation op = new EditOperation();
            op.Name = "Update annotation";
            op.Modify(insp);
    
            //OR using a Dictionary - again TEXTSTRING has to exist in the schema
            //Dictionary<string, object> newAtts = new Dictionary<string, object>();
            //newAtts.Add("TEXTSTRING", "hello world");
            //op.Modify(annoLayer, oid, newAtts);
    
            op.Execute();
        }
    });
    Inheritance Hierarchy

    System.Object
       ArcGIS.Desktop.Framework.Contracts.PropertyChangedBase
          ArcGIS.Desktop.Editing.Attributes.Attribute

    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also