Table of Contents

Method TryGetValue

Namespace
DisCatSharp.Entities
Assembly
DisCatSharp.dll

TryGetValue<T>(out T?)

Attempts to parse the current interaction option value into the requested type without throwing.

public bool TryGetValue<T>(out T? value)

Parameters

value T

The parsed value when successful; otherwise the default value for T.

Returns

bool

true when the value could be converted to T; otherwise false.

Type Parameters

T

The target value type to read.

Remarks

This is especially useful for autocomplete providers, where focused options can contain partially typed text that is not yet valid for the declared command option type.