Search Results for

    Show / Hide Table of Contents

    Class Optional

    Helper methods for instantiating an Optional<T>.

    Inheritance
    System.Object
    Optional
    Namespace: DisCatSharp.Entities
    Assembly: DisCatSharp.dll
    Syntax
    public static class Optional
    Remarks

    This class only serves to provide Some<T>(T) and None as utility that supports type inference.

    Fields

    | Improve this Doc View Source

    None

    Provided for easy creation of empty Optional<T>s.

    Declaration
    public static readonly None None
    Field Value
    Type Description
    None

    Methods

    | Improve this Doc View Source

    FromNoValue<T>()

    Creates a new empty Optional<T> with no value and invalid state.

    Declaration
    [Obsolete("Use None.")]
    public static Optional<T> FromNoValue<T>()
    Returns
    Type Description
    Optional<T>

    Created optional.

    Type Parameters
    Name Description
    T

    The type that the created instance is wrapping around.

    | Improve this Doc View Source

    FromNullable<T>(T)

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

    FromValue<T>(T)

    Creates a new Optional<T> with specified value and valid state.

    Declaration
    [Obsolete("Renamed to Some.")]
    public static Optional<T> FromValue<T>(T value)
    Parameters
    Type Name Description
    T value

    Value to populate the optional with.

    Returns
    Type Description
    Optional<T>

    Created optional.

    Type Parameters
    Name Description
    T

    Type of the value.

    | Improve this Doc View Source

    Some<T>(T)

    Creates a new Optional<T> with specified value and valid state.

    Declaration
    public static Optional<T> Some<T>(T value)
    Parameters
    Type Name Description
    T value

    Value to populate the optional with.

    Returns
    Type Description
    Optional<T>

    Created optional.

    Type Parameters
    Name Description
    T

    Type of the value.

    • Improve this Doc
    • View Source
    In This Article
    Back to top © 2021-2022 Aiko IT Systems