Optional<T>
public struct Optional<T> : IEquatable<Optional<T>>, IEquatable<T>, IStructuralEquatable, IOptionMonad<T, Optional<T>>, IOptionMonad<T>, ISupplier<object>, IFunctional<Func<object>>
A container object which may or may not contain a value.
Represents optional container without value.
Indicates whether the value is present.
Indicates that the value is null.
Indicates that the value is undefined.
If a value is present, returns the value, otherwise throw exception.
If a value is present, returns the value, otherwise default value.
Obtains immutable reference to the value in the container.
Constructs non-empty container.
Determines whether the object represents meaningful value.
Returns non-empty container.
Returns the value if present; otherwise return default value.
Determines whether two containers store the same value.
Determines whether two containers are empty or have values.
Extracts value stored in the Optional container.
Checks whether the container has no value.
Wraps value into Optional container.
Determines whether two containers store the different values.
Checks whether the container has value.
Boxes value encapsulated by this object.
If a value is present, apply the provided mapping function to it, and if the result is
non-null, return an Optional describing the result. Otherwise returns None.
If a value is present, apply the provided mapping function to it, and if the result is
non-null, return an Optional describing the result. Otherwise returns None.
Determines whether this container stored the same
value as the specified value.
Determines whether this container stores
the same value as other.
Performs equality check between stored value
and the specified value using method Equals.
Computes hash code for the stored value
using method GetHashCode.
public T& modreq(System.Runtime.InteropServices.InAttribute) GetReference<TException>() where TException : Exception
Obtains immutable reference to the value in the container.
public T& modreq(System.Runtime.InteropServices.InAttribute) GetReference(Func<Exception> exceptionFactory)
Obtains immutable reference to the value in the container.
If a value is present, and the value matches the given predicate,
return an Optional describing the value, otherwise return an empty Optional.
Returns the value if present; otherwise return default value.
Returns the value if present; otherwise invoke delegate.
If a value is present, returns the value, otherwise throw exception.
If a value is present, returns the value, otherwise throw exception.
Attempts to extract value from container if it is present.
Attempts to extract value from container if it is present.