Class Try<T>
Represents either success or failure of some operation
Assembly: Akka.dll
Syntax
Type Parameters
Name |
Description |
T |
Success type
|
Constructors
|
Improve this Doc
View Source
Try(T)
Creates Try<T> with success result
Declaration
Parameters
Type |
Name |
Description |
T |
success |
|
|
Improve this Doc
View Source
Try(Exception)
Declaration
public Try(Exception failure)
Parameters
Properties
|
Improve this Doc
View Source
Failure
If set, contains failure description
Declaration
public Option<Exception> Failure { get; }
Property Value
|
Improve this Doc
View Source
IsSuccess
Declaration
public bool IsSuccess { get; }
Property Value
|
Improve this Doc
View Source
Success
If set, contains successfull execution result
Declaration
public Option<T> Success { get; }
Property Value
Methods
|
Improve this Doc
View Source
From(Func<T>)
Gets Try<T> result from function execution
Declaration
public static Try<T> From(Func<T> func)
Parameters
Type |
Name |
Description |
Func<T> |
func |
|
Returns
|
Improve this Doc
View Source
Get()
Returns the value from this Success or throws the exception if this is a Failure.
Declaration
Returns
|
Improve this Doc
View Source
GetOrElse(Func<T>)
Returns this Try if it's a Success or tries execute given fallback if this is a Failure.
Declaration
public Try<T> GetOrElse(Func<T> fallback)
Parameters
Type |
Name |
Description |
Func<T> |
fallback |
|
Returns
|
Improve this Doc
View Source
OrElse(Try<T>)
Returns this Try if it's a Success or the given default argument if this is a Failure.
Declaration
public Try<T> OrElse(Try<T> default)
Parameters
Type |
Name |
Description |
Try<T> |
default |
|
Returns
|
Improve this Doc
View Source
Recover(Action<Exception>)
Applies the given function f if this is a Failure, otherwise returns this if this is a Success.
Declaration
public Try<T> Recover(Action<Exception> failureHandler)
Parameters
Returns
|
Improve this Doc
View Source
RecoverWith(Func<Exception, Try<T>>)
Applies the given function f
if this is a Failure
, otherwise returns this if this is a Success
.
Declaration
public Try<T> RecoverWith(Func<Exception, Try<T>> failureHandler)
Parameters
Returns
Operators
|
Improve this Doc
View Source
Implicit(T to Try<T>)
Declaration
public static implicit operator Try<T>(T value)
Parameters
Type |
Name |
Description |
T |
value |
|
Returns
Extension Methods