Method IsDefined
- Namespace
- DSharpPlus.Entities
- Assembly
- DSharpPlus.dll
IsDefined(DiscordPermission)
Returns a boolean telling whether the given enum value exists in the enumeration.
public static bool IsDefined(DiscordPermission value)
Parameters
valueDiscordPermissionThe value to check if it's defined
Returns
- bool
trueif the value exists in the enumeration,falseotherwise
IsDefined(string)
Returns a boolean telling whether an enum with the given name exists in the enumeration.
public static bool IsDefined(string name)
Parameters
namestringThe name to check if it's defined
Returns
- bool
trueif a member with the name exists in the enumeration,falseotherwise
IsDefined(string, bool)
Returns a boolean telling whether an enum with the given name exists in the enumeration,
or if a member decorated with a [Display] attribute
with the required name exists.
public static bool IsDefined(string name, bool allowMatchingMetadataAttribute)
Parameters
namestringThe name to check if it's defined
allowMatchingMetadataAttributeboolIf
true, considers the value of metadata attributes,otherwise ignores them
Returns
- bool
trueif a member with the name exists in the enumeration, or a member is decorated with a[Display]attribute with the name,falseotherwise
IsDefined(in ReadOnlySpan<char>)
Returns a boolean telling whether an enum with the given name exists in the enumeration
public static bool IsDefined(in ReadOnlySpan<char> name)
Parameters
nameReadOnlySpan<char>The name to check if it's defined
Returns
- bool
trueif a member with the name exists in the enumeration,falseotherwise
IsDefined(in ReadOnlySpan<char>, bool)
Returns a boolean telling whether an enum with the given name exists in the enumeration,
or optionally if a member decorated with a [Display] attribute
with the required name exists.
Slower then the IsDefined(string, bool) overload, but doesn't allocate memory./>
public static bool IsDefined(in ReadOnlySpan<char> name, bool allowMatchingMetadataAttribute)
Parameters
nameReadOnlySpan<char>The name to check if it's defined
allowMatchingMetadataAttributeboolIf
true, considers the value of metadata attributes,otherwise ignores them
Returns
- bool
trueif a member with the name exists in the enumeration, or a member is decorated with a[Display]attribute with the name,falseotherwise