Search Results for

    Show / Hide Table of Contents

    Class Optional

    Helper methods for instantiating an Optional<T>.

    Inheritance
    Object
    Optional
    Inherited Members
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Object.ReferenceEquals(Object, Object)
    Object.ToString()
    Namespace: KSharpPlus.Entities
    Assembly: KSharpPlus.dll
    Syntax
    public static class Optional
    Remarks

    This class only serves to allow type parameter inference on calls to FromValue<T>(T) or FromNoValue<T>().

    Methods

    | Improve this Doc View Source

    FromNoValue<T>()

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

    Declaration
    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

    FromValue<T>(T)

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

    Declaration
    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
    In This Article
    Back to top © 2023 KSharpPlus Contributors