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
Result<TOk, TErr>
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
|
Edit this page
View Source
IsFailure
Declaration
public bool IsFailure { get; }
Property Value
|
Edit this page
View Source
Success
Declaration
public bool Success { get; init; }
Property Value
|
Edit this page
View Source
Value
Declaration
public TOk Value { get; init; }
Property Value
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> |
|