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
value
DiscordPermissionThe value to check if it's defined
Returns
- bool
true
if the value exists in the enumeration,false
otherwise
IsDefined(string)
Returns a boolean telling whether an enum with the given name exists in the enumeration.
public static bool IsDefined(string name)
Parameters
name
stringThe name to check if it's defined
Returns
- bool
true
if a member with the name exists in the enumeration,false
otherwise
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
name
stringThe name to check if it's defined
allowMatchingMetadataAttribute
boolIf
true
, considers the value of metadata attributes,otherwise ignores them
Returns
- bool
true
if a member with the name exists in the enumeration, or a member is decorated with a[Display]
attribute with the name,false
otherwise
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
name
ReadOnlySpan<char>The name to check if it's defined
Returns
- bool
true
if a member with the name exists in the enumeration,false
otherwise
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
name
ReadOnlySpan<char>The name to check if it's defined
allowMatchingMetadataAttribute
boolIf
true
, considers the value of metadata attributes,otherwise ignores them
Returns
- bool
true
if a member with the name exists in the enumeration, or a member is decorated with a[Display]
attribute with the name,false
otherwise