Table of Contents

Class OptionHandlerResult<T>

Namespace
Albatross.CommandLine
Assembly
Albatross.CommandLine.dll

Wraps the result of an option handler that may or may not produce a value.

public record OptionHandlerResult<T> : IEquatable<OptionHandlerResult<T>> where T : notnull

Type Parameters

T

The type of the value.

Inheritance
OptionHandlerResult<T>
Implements
Inherited Members

Constructors

OptionHandlerResult()

Creates an empty result with no value.

public OptionHandlerResult()

OptionHandlerResult(T)

Creates a result containing the specified value.

public OptionHandlerResult(T value)

Parameters

value T

The value to wrap.

Properties

HasValue

Gets a value indicating whether this result contains a value.

public bool HasValue { get; }

Property Value

bool

Value

Gets the contained value. Throws if HasValue is false.

public T Value { get; }

Property Value

T

Exceptions

InvalidOperationException

Thrown when accessing the value when HasValue is false.