Class Result<TValue>
- Namespace
- Compendium.Core.Results
- Assembly
- Compendium.Core.dll
Represents the result of an operation that can either succeed with a value or fail.
public sealed class Result<TValue> : Result
Type Parameters
TValueThe type of the value returned on success.
- Inheritance
-
Result<TValue>
- Inherited Members
- Extension Methods
Properties
Value
Gets the value of the result.
public TValue Value { get; }
Property Value
- TValue
Exceptions
- InvalidOperationException
Thrown when accessing the value of a failed result.
Methods
ToString()
Returns a string representation of the result.
public override string ToString()
Returns
- string
A string that represents the current result.
Operators
implicit operator Result<TValue>(Error)
Implicitly converts an Error to a failed Result.
public static implicit operator Result<TValue>(Error error)
Parameters
errorErrorThe error.
Returns
- Result<TValue>
implicit operator Result<TValue>(TValue)
Implicitly converts a value to a successful Result.
public static implicit operator Result<TValue>(TValue value)
Parameters
valueTValueThe value.
Returns
- Result<TValue>