<PackageReference Include="System.Configuration.ConfigurationManager" Version="10.0.0-preview.1.25080.5" />

CallbackValidator

Provides dynamic validation of an object.
namespace System.Configuration { public sealed class CallbackValidator : ConfigurationValidatorBase { private readonly ValidatorCallback _callback; private readonly Type _type; public CallbackValidator(Type type, ValidatorCallback callback) : this(callback) { if (type == (Type)null) throw new ArgumentNullException("type"); _type = type; } internal CallbackValidator(ValidatorCallback callback) { if (callback == null) throw new ArgumentNullException("callback"); _type = null; _callback = callback; } public override bool CanValidate(Type type) { if (!(type == _type)) return _type == (Type)null; return true; } public override void Validate(object value) { _callback(value); } } }