Class Result
Represents extension methods for type Result<T>.
Namespace: DotNext
Assembly: DotNext.dll
Syntax
public static class Result : object
Methods
| Improve this Doc View SourceCoalesce<T>(Result<T>, Result<T>)
Returns the second result if the first is unsuccessful.
Declaration
public static Result<T> Coalesce<T>(this in Result<T> first, in Result<T> second)
Parameters
Type | Name | Description |
---|---|---|
Result<T> | first | The first result. |
Result<T> | second | The second result. |
Returns
Type | Description |
---|---|
Result<T> | The second result if the first is unsuccessful; otherwise, the first result. |
Type Parameters
Name | Description |
---|---|
T | The type of value. |
GetUnderlyingType(Type)
Returns the underlying type argument of the specified result type.
Declaration
public static Type GetUnderlyingType(Type resultType)
Parameters
Type | Name | Description |
---|---|---|
Type | resultType | Result type. |
Returns
Type | Description |
---|---|
Type | Underlying type argument of result type; otherwise, null. |
IsResult(Type)
Indicates that specified type is result type.
Declaration
public static bool IsResult(this Type resultType)
Parameters
Type | Name | Description |
---|---|---|
Type | resultType |
Returns
Type | Description |
---|---|
Boolean | true, if specified type is result type; otherwise, false. |
OrNull<T>(Result<T>)
If a result is successful, returns it, otherwise null.
Declaration
public static T? OrNull<T>(this in Result<T> result)
where T : struct
Parameters
Type | Name | Description |
---|---|---|
Result<T> | result | The result. |
Returns
Type | Description |
---|---|
Nullable<T> | Nullable value. |
Type Parameters
Name | Description |
---|---|
T | Value type. |