Struct Result
- Namespace
- LfrlAnvil
- Assembly
- LfrlAnvil.Core.dll
Represents a result of an operation.
public readonly struct Result
- Inherited Members
- Extension Methods
Properties
Exception
Optional Exception associated with this result.
public Exception? Exception { get; }
Property Value
Valid
Returns a valid Result instance.
public static Result Valid { get; }
Property Value
Methods
Create<T>(T?)
Creates a Result<T> with optional value.
[Pure]
public static Result<T> Create<T>(T? value = default)
Parameters
value
TOptional value associated with the result.
Returns
Type Parameters
T
Type of an optional value.
Error(Exception)
Creates a Result with exception.
[Pure]
public static Result Error(Exception exception)
Parameters
Returns
Error<T>(Exception, T?)
Creates a Result<T> with exception and optional value.
[Pure]
public static Result<T> Error<T>(Exception exception, T? value = default)
Parameters
exception
ExceptionException associated with the result.
value
TOptional value associated with the result.
Returns
Type Parameters
T
Type of an optional value.
ThrowIfError()
Rethrows the Exception, if it isn't null, otherwise does nothing.
public void ThrowIfError()
ToString()
Returns the fully qualified type name of this instance.
[Pure]
public override string ToString()
Returns
- string
The fully qualified type name.