ArcGIS Pro 3.2 API Reference Guide
ArcGIS.Desktop.Editing.Attributes Namespace / Attribute Class / AddValidate Method
an anonymous method
Example

In This Topic
    AddValidate Method
    In This Topic
    Add custom validation functions for this attribute. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax

    Parameters

    f
    an anonymous method
    Exceptions
    ExceptionDescription
    This method or property must be called within the lambda passed to QueuedTask.Run.
    Example
    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

    ArcGIS Pro version: 3 or higher.
    See Also