Table of Contents

Class ValidationResult

Namespace
Webefinity.Switch
Assembly
Switch.dll

Provides information about the validity of an individual command option, and the entire command line. Instances of the ValidationResult are combined by the ArgumentHandler using the Combine method.

public class ValidationResult
Inheritance
ValidationResult
Inherited Members

Constructors

ValidationResult(bool, params string[])

Construct a new validation result.

public ValidationResult(bool isValid = true, params string[] errors)

Parameters

isValid bool

Was the validation successful (true), or did it fail (false).

errors string[]

Any errors that describe the validation failure.

Properties

Errors

A list of errors that describe a validation failure.

public ICollection<string> Errors { get; }

Property Value

ICollection<string>

IsValid

True if the validation was successful. False if the validation was unsuccessful. Will usually contain Errors.

public bool IsValid { get; }

Property Value

bool

Methods

Combine(params ValidationResult[])

Stack another validation on top of this one. The result is valid only if the passed results, and the current result, were all valid. Errors are combined into a single list.

public void Combine(params ValidationResult[] validationResults)

Parameters

validationResults ValidationResult[]

The