The recording of the first ever ReactiveUI virtual conference is available on our YouTube Channel.

OptionExtensions Class

Summary

Extensions for optional.
Namespace
DynamicData.Kernel
Base Types
  • object
graph BT Type-->Base0["object"] Type["OptionExtensions"] class Type type-node

Syntax

public static class OptionExtensions

Methods

Name Value Summary
Convert<TSource, TDestination>(Optional<TSource>, Func<TSource, TDestination>) Optional<TDestination>
Converts the specified source.
static
ConvertOr<TSource, TDestination>(Optional<TSource>, Func<TSource?, TDestination?>, Func<TDestination?>) TDestination?
Converts the option value if it has a value, otherwise returns the result of the fallback converter.
static
FirstOrOptional<T>(IEnumerable<T>, Func<T, bool>) Optional<T>
Overloads Enumerable.FirstOrDefault() and wraps the result in a Optional &gt;T container.
static
IfHasValue<T>(Optional<T>, Action<T>) OptionElse
Invokes the specified action when.
static
IfHasValue<T>(Optional<T>?, Action<T>) OptionElse
Invokes the specified action when.
static
Lookup<TValue, TKey>(IDictionary<TKey, TValue>, TKey) Optional<TValue>
Overloads a TryGetValue of the dictionary wrapping the result as an Optional. &gt;TValue
static
RemoveIfContained<TValue, TKey>(IDictionary<TKey, TValue>, TKey) bool
Removes item if contained in the cache.
static
SelectValues<T>(IEnumerable<Optional<T>>) IEnumerable<T>
Filters where Optional has a value and return the values only.
static
ValueOr<T>(Optional<T>, Func<T>) T
Returns the value if the optional has a value, otherwise returns the result of the value selector.
static
ValueOr<T>(T?, T) T
Returns the value if the nullable has a value, otherwise returns the result of the value selector.
static
ValueOrDefault<T>(Optional<T>) T?
Returns the value if the optional has a value, otherwise returns the default value of T.
static
ValueOrThrow<T>(Optional<T>, Func<Exception>) T
Returns the value if the optional has a value, otherwise throws an exception as specified by the exception generator.
static

Extension Methods

Name Value Summary
InvokeViewModelAction<T>(Action<T>) object
This is a thing I lifted from Prism.