Class Optional
Assembly: Recore.dll
Syntax
public static class Optional
Methods
|
Improve this Doc
View Source
AwaitAsync<T>(Optional<Task<T>>)
Converts an Optional<Task<T>>
to a Task<Optional<T>>
.
Declaration
public static Task<Optional<T>> AwaitAsync<T>(this Optional<Task<T>> optionalTask)
Parameters
Returns
Type Parameters
|
Improve this Doc
View Source
Flatten<T>(Optional<Optional<T>>)
Declaration
public static Optional<T> Flatten<T>(this Optional<Optional<T>> optionalOptional)
Parameters
Returns
Type Parameters
|
Improve this Doc
View Source
Flatten<T>(Optional<Nullable<T>>)
Declaration
public static Optional<T> Flatten<T>(this Optional<T?> optionalNullable)
where T : struct
Parameters
Returns
Type Parameters
|
Improve this Doc
View Source
If<T>(Boolean, T)
Sets an optional value if a condition is true.
Declaration
public static Optional<T> If<T>(bool condition, T value)
Parameters
Type |
Name |
Description |
Boolean |
condition |
|
T |
value |
|
Returns
Type Parameters
|
Improve this Doc
View Source
If<T>(Boolean, Func<T>)
Sets an optional value if a condition is true.
Declaration
public static Optional<T> If<T>(bool condition, Func<T> func)
Parameters
Returns
Type Parameters
|
Improve this Doc
View Source
Lift<T>(Action<T>)
Declaration
public static Action<Optional<T>> Lift<T>(Action<T> action)
Parameters
Type |
Name |
Description |
Action<T> |
action |
|
Returns
Type Parameters
|
Improve this Doc
View Source
Lift<T, TResult>(Func<T, TResult>)
Declaration
public static Func<Optional<T>, Optional<TResult>> Lift<T, TResult>(Func<T, TResult> func)
Parameters
Type |
Name |
Description |
Func<T, TResult> |
func |
|
Returns
Type Parameters
Name |
Description |
T |
|
TResult |
|
|
Improve this Doc
View Source
NonEmpty<T>(IEnumerable<Optional<T>>)
Collects the non-empty values from the sequence.
Declaration
public static IEnumerable<T> NonEmpty<T>(this IEnumerable<Optional<T>> source)
Parameters
Returns
Type Parameters
|
Improve this Doc
View Source
Of<T>(T)
Declaration
public static Optional<T> Of<T>(T value)
Parameters
Type |
Name |
Description |
T |
value |
|
Returns
Type Parameters
|
Improve this Doc
View Source
Of<T>(Nullable<T>)
Declaration
public static Optional<T> Of<T>(T? value)
where T : struct
Parameters
Returns
Type Parameters