Search Results for

    Show / Hide Table of Contents

    Struct Option<T>

    Allows tracking of whether a value has be initialized (even with the default value) for both reference and value types. Useful where distinguishing between null (or zero, or false) and uninitialized is significant.

    Inherited Members
    Object.Equals(Object, Object)
    Object.GetType()
    Object.ReferenceEquals(Object, Object)
    Namespace: Akka.Util
    Assembly: Akka.dll
    Syntax
    public readonly struct Option<T>
    Type Parameters
    Name Description
    T

    TBD

    Constructors

    | Improve this Doc View Source

    Option(T)

    Declaration
    [Obsolete("Use Option<T>.Create() instead")]
    public Option(T value)
    Parameters
    Type Name Description
    T value

    Fields

    | Improve this Doc View Source

    None

    None.

    Declaration
    public static readonly Option<T> None
    Field Value
    Type Description
    Option<T>

    Properties

    | Improve this Doc View Source

    HasValue

    TBD

    Declaration
    public readonly bool HasValue { get; }
    Property Value
    Type Description
    Boolean
    | Improve this Doc View Source

    IsEmpty

    Declaration
    public readonly bool IsEmpty { get; }
    Property Value
    Type Description
    Boolean
    | Improve this Doc View Source

    Value

    TBD

    Declaration
    public readonly T Value { get; }
    Property Value
    Type Description
    T

    Methods

    | Improve this Doc View Source

    Create(T)

    Declaration
    public static Option<T> Create(T value)
    Parameters
    Type Name Description
    T value
    Returns
    Type Description
    Option<T>
    | Improve this Doc View Source

    Equals(Option<T>)

    Declaration
    public readonly bool Equals(Option<T> other)
    Parameters
    Type Name Description
    Option<T> other
    Returns
    Type Description
    Boolean
    | Improve this Doc View Source

    Equals(Object)

    Declaration
    public override readonly bool Equals(object obj)
    Parameters
    Type Name Description
    Object obj
    Returns
    Type Description
    Boolean
    Overrides
    ValueType.Equals(Object)
    | Improve this Doc View Source

    FlatSelect<TNew>(Func<T, Option<TNew>>)

    Unwraps the option value and returns it without converting it into an option.

    Declaration
    public readonly Option<TNew> FlatSelect<TNew>(Func<T, Option<TNew>> mapper)
    Parameters
    Type Name Description
    Func<T, Option<TNew>> mapper

    The mapping method.

    Returns
    Type Description
    Option<TNew>
    Type Parameters
    Name Description
    TNew

    The output type.

    | Improve this Doc View Source

    GetHashCode()

    Declaration
    public override readonly int GetHashCode()
    Returns
    Type Description
    Int32
    Overrides
    ValueType.GetHashCode()
    | Improve this Doc View Source

    GetOrElse(T)

    Gets option value, if any, otherwise returns default value provided

    Declaration
    public readonly T GetOrElse(T fallbackValue)
    Parameters
    Type Name Description
    T fallbackValue
    Returns
    Type Description
    T
    | Improve this Doc View Source

    OnSuccess(Action<T>)

    Applies specified action to this option, if there is a value

    Declaration
    public readonly void OnSuccess(Action<T> action)
    Parameters
    Type Name Description
    Action<T> action
    | Improve this Doc View Source

    Select<TNew>(Func<T, TNew>)

    Applies selector to option value, if value is set

    Declaration
    public readonly Option<TNew> Select<TNew>(Func<T, TNew> selector)
    Parameters
    Type Name Description
    Func<T, TNew> selector
    Returns
    Type Description
    Option<TNew>
    Type Parameters
    Name Description
    TNew
    | Improve this Doc View Source

    ToString()

    Declaration
    public override readonly string ToString()
    Returns
    Type Description
    String
    Overrides
    ValueType.ToString()

    Operators

    | Improve this Doc View Source

    Equality(Option<T>, Option<T>)

    Declaration
    public static bool operator ==(Option<T> left, Option<T> right)
    Parameters
    Type Name Description
    Option<T> left
    Option<T> right
    Returns
    Type Description
    Boolean
    | Improve this Doc View Source

    Implicit(T to Option<T>)

    Performs an implicit conversion from T to Option<T>.

    Declaration
    public static implicit operator Option<T>(T value)
    Parameters
    Type Name Description
    T value

    The object to convert

    Returns
    Type Description
    Option<T>

    The result of the conversion.

    | Improve this Doc View Source

    Inequality(Option<T>, Option<T>)

    Declaration
    public static bool operator !=(Option<T> left, Option<T> right)
    Parameters
    Type Name Description
    Option<T> left
    Option<T> right
    Returns
    Type Description
    Boolean

    Extension Methods

    ObjectExtensions.IsDefaultForType<T>(T)
    ObjectExtensions.AsOption<T>(T)
    Extensions.AsInstanceOf<T>(Object)
    In This Article
    • githubImprove this Doc
    • View Source
    Back to top
    Contribute
    • Project Chat
    • Discussion Forum
    • Source Code
    Support
    • Akka.NET Support Plans
    • Akka.NET Observability Tools
    • Akka.NET Training & Consulting
    Maintained By
    • Petabridge - The Akka.NET Company
    • Learn Akka.NET