Class Optional
Helper methods for instantiating an Optional<T>.
Inherited Members
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 SourceFromNoValue<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. |
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. |