Casper.Network.SDK
Show / Hide Table of Contents

Class Result<TOk, TErr>

Equivalent to the Result type in Rust. It can wrap a value with type TOk when the returning method returns successfully. Or an error with type TErr when the method needs to return an error.

Inheritance
object
Result<TOk, TErr>
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: Casper.Network.SDK.Types
Assembly: Casper.Network.SDK.dll
Syntax
public class Result<TOk, TErr>
Type Parameters
Name Description
TOk

Type of the object returned with Ok result.

TErr

Type of the object returned with Error result.

Constructors

| Edit this page View Source

Result(TOk, TErr, bool)

Declaration
protected Result(TOk ok, TErr err, bool success)
Parameters
Type Name Description
TOk ok
TErr err
bool success

Properties

| Edit this page View Source

Error

Declaration
public TErr Error { get; init; }
Property Value
Type Description
TErr
| Edit this page View Source

IsFailure

Declaration
public bool IsFailure { get; }
Property Value
Type Description
bool
| Edit this page View Source

Success

Declaration
public bool Success { get; init; }
Property Value
Type Description
bool
| Edit this page View Source

Value

Declaration
public TOk Value { get; init; }
Property Value
Type Description
TOk

Methods

| Edit this page View Source

Fail(TErr)

Declaration
public static Result<TOk, TErr> Fail(TErr err)
Parameters
Type Name Description
TErr err
Returns
Type Description
Result<TOk, TErr>
| Edit this page View Source

Ok(TOk)

Declaration
public static Result<TOk, TErr> Ok(TOk value)
Parameters
Type Name Description
TOk value
Returns
Type Description
Result<TOk, TErr>
  • Edit this page
  • View Source
In this article
Back to top Maintained by MAKE Technology LLC