Table of Contents

Struct Optional<T>

Namespace
Discord
Assembly
Discord.Net.Core.dll
public struct Optional<T>

Type Parameters

T
Inherited Members

Constructors

Optional(T)

Creates a new Parameter with the provided value.

public Optional(T value)

Parameters

value T

Properties

IsSpecified

Returns true if this value has been specified.

public readonly bool IsSpecified { get; }

Property Value

bool

Unspecified

public static Optional<T> Unspecified { get; }

Property Value

Optional<T>

Value

Gets the value for this parameter.

public T Value { get; }

Property Value

T

Exceptions

InvalidOperationException

This property has no value set.

Methods

Equals(object)

Indicates whether this instance and a specified object are equal.

public override bool Equals(object other)

Parameters

other object

Returns

bool

true if obj and this instance are the same type and represent the same value; otherwise, false.

GetHashCode()

Returns the hash code for this instance.

public override int GetHashCode()

Returns

int

A 32-bit signed integer that is the hash code for this instance.

GetValueOrDefault()

public T GetValueOrDefault()

Returns

T

GetValueOrDefault(T)

public T GetValueOrDefault(T defaultValue)

Parameters

defaultValue T

Returns

T

ToString()

Returns the fully qualified type name of this instance.

public override string ToString()

Returns

string

The fully qualified type name.

Operators

explicit operator T(Optional<T>)

public static explicit operator T(Optional<T> value)

Parameters

value Optional<T>

Returns

T

implicit operator Optional<T>(T)

public static implicit operator Optional<T>(T value)

Parameters

value T

Returns

Optional<T>