ArcGIS Pro 2.7 API Reference Guide
Create Method (Attribute.ValidationError)
Example 

ArcGIS.Desktop.Editing.Attributes Namespace > Attribute.ValidationError Structure : Create Method
Description of the error.
Severity of the error.
Creates a new ValidationError.
Syntax
Public Shared Function Create( _
   ByVal desc As String, _
   ByVal severity As Severity _
) As Attribute.ValidationError

Parameters

desc
Description of the error.
severity
Severity of the error.

Return Value

The new validation error.
Example
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 10, Windows 8.1

See Also

Reference

Attribute.ValidationError Structure
Attribute.ValidationError Members