Show / Hide Table of Contents

Class Result

Represents extension methods for type Result<T>.

Inheritance
Object
Result
Inherited Members
Object.Equals(Object)
Object.Equals(Object, Object)
Object.GetHashCode()
Object.GetType()
Object.MemberwiseClone()
Object.ReferenceEquals(Object, Object)
Object.ToString()
Namespace: DotNext
Assembly: DotNext.dll
Syntax
public static class Result

Methods

| Improve this Doc View Source

Coalesce<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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

IsResult(Type)

Indicates that specified type is result type.

Declaration
public static bool IsResult(this Type resultType)
Parameters
Type Name Description
Type resultType

The type of Result<T>.

Returns
Type Description
Boolean

true, if specified type is result type; otherwise, false.

| Improve this Doc View Source

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.

  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX