AsContinuation
Converts a TSuccess or a TFail value in a Continuation<TFail, TSuccess>.
Parameters
Returns
TSuccess value
Continuation<TFail, TSuccess>
TFail value
Continuation<TFail, TSuccess>
Usage
This method is usually used to start a new Continuation pipeline either in Success or Fail state.
When value is a TSuccess
string result = 10.AsContinuation<string, int>()
.Then(value => value + 10)
.Catch(fail => $"Error: {fail}")
.Match(number => number.ToString(),
error => error);
//result = "20"When value is a TFail
string result = "test".AsContinuation<string, int>()
.Then(value => value + 10)
.Catch(fail => $"Error: {fail}")
.Match(number => number.ToString(),
error => error);
//result = "Error: test"Last updated
Was this helpful?