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
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
IsDefined(string, bool)
Returns a boolean telling whether an enum with the given name exists in the enumeration, or if a member decorated with EnumMemberAttribute 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 EnumMemberAttribute instead of the member name, 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
nameReadOnlySpan<char>The name to check if it's defined
Returns
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 EnumMemberAttribute 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