ArcGIS Pro 3.0 API Reference Guide
ArcGIS.Desktop.Editing.Attributes Namespace / Inspector Class / Inspector Constructor
Example

In This Topic
    Inspector Constructor
    In This Topic
    Create a new instance of the inspector class.
    Syntax
    public Inspector()
    Public Function New()
    Example
    Load a feature from a layer into the inspector
    // get the first feature layer in the map
    var firstFeatureLayer = ArcGIS.Desktop.Mapping.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 feature with ObjectID 'oid' into the inspector
    await inspector.LoadAsync(firstFeatureLayer, oid);
    
    Inspector.AddValidate
    var insp = new Inspector();
    insp.LoadSchema(featLayer);
    var attrib = insp.Where(a => a.FieldName == "Mineral").First();
    
    attrib.AddValidate(() =>
    {
      if (attrib.CurrentValue.ToString() == "Salt")
        return Enumerable.Empty<ArcGIS.Desktop.Editing.Attributes.Attribute.ValidationError>();
      else return new[] { ArcGIS.Desktop.Editing.Attributes.Attribute.ValidationError.Create("Error", ArcGIS.Desktop.Editing.Attributes.Severity.Low) };
    });
    Requirements

    Target Platforms: Windows 11, Windows 10, Windows 8.1

    See Also