<PackageReference Include="Microsoft.IdentityModel.Tokens" Version="8.14.0" />

Microsoft.IdentityModel.Tokens.Experimental.ValidationResult<TResult, TError>

public struct ValidationResult<TResult, TError> : IEquatable<ValidationResult<TResult, TError>> where TError : ValidationError
Represents the result of an validation that can either succeed with a valid result or failed with a specific error.
public TError Error { get; }

Gets the error associated with the validation result.

public TResult Result { get; }

Gets the result associated with the validation result.

public bool Succeeded { get; }

Gets a value indicating whether the validation succeeded.

public ValidationResult(TResult result)

Creates a new instance of ValidationResult<T, U> indicating a successful validation and containing an object of the associated type.

public ValidationResult(TError error)

Creates a new instance of ValidationResult<T, U> indicating a failed validation and containing error information.

Empty constructor implementation to prevent creating an empty result.

public static bool op_Equality(ValidationResult<TResult, TError> left, ValidationResult<TResult, TError> right)

public static ValidationResult<TResult, TError> op_Implicit(TResult result)

Creates an ValidationResult<T, U>, successful result implicitly from the value.

public static ValidationResult<TResult, TError> op_Implicit(TError error)

Creates an ValidationResult<T, U> result implicitly from the error value.

public static bool op_Inequality(ValidationResult<TResult, TError> left, ValidationResult<TResult, TError> right)

public bool Equals(ValidationResult<TResult, TError> other)

public ValidationResult<TResult, TError> ToValidationResult()

Casts the result to a ValidationResult<T, U>.