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
System.Object
Result<TOk, TErr>
Namespace: Casper.Network.SDK.Types
Assembly: Casper.Network.SDK.dll
Syntax
public class Result<TOk, TErr> : object
Type Parameters
Name Description
TOk

Type of the object returned with Ok result.

TErr

Type of the object returned with Error result.

Constructors

Result(TOk, TErr, Boolean)

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

Properties

Error

Declaration
public TErr Error { get; set; }
Property Value
Type Description
TErr

IsFailure

Declaration
public bool IsFailure { get; }
Property Value
Type Description
System.Boolean

Success

Declaration
public bool Success { get; set; }
Property Value
Type Description
System.Boolean

Value

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

Methods

Fail(TErr)

Declaration
public static Result<TOk, TErr> Fail(TErr err)
Parameters
Type Name Description
TErr err
Returns
Type Description
Result<TOk, TErr>

Ok(TOk)

Declaration
public static Result<TOk, TErr> Ok(TOk value)
Parameters
Type Name Description
TOk value
Returns
Type Description
Result<TOk, TErr>
In This Article
Back to top Maintained by MAKE Technology LLC