Method TryParse
- Namespace
- DSharpPlus.Entities
- Assembly
- DSharpPlus.dll
TryParse(string?, out DiscordPermission)
Converts the string representation of the name or numeric value of an DiscordPermission to the equivalent instance. The return value indicates whether the conversion succeeded.
public static bool TryParse(string? name, out DiscordPermission value)
Parameters
namestringThe case-sensitive string representation of the enumeration name or underlying value to convert
valueDiscordPermissionWhen this method returns, contains an object of type DiscordPermission whose value is represented by
valueif the parse operation succeeds. If the parse operation fails, contains the default value of the underlying type of DiscordPermission. This parameter is passed uninitialized.
Returns
TryParse(string?, out DiscordPermission, bool)
Converts the string representation of the name or numeric value of an DiscordPermission to the equivalent instance. The return value indicates whether the conversion succeeded.
public static bool TryParse(string? name, out DiscordPermission value, bool ignoreCase)
Parameters
namestringThe string representation of the enumeration name or underlying value to convert
valueDiscordPermissionWhen this method returns, contains an object of type DiscordPermission whose value is represented by
valueif the parse operation succeeds. If the parse operation fails, contains the default value of the underlying type of DiscordPermission. This parameter is passed uninitialized.ignoreCasebooltrue to read value in case insensitive mode; false to read value in case sensitive mode.
Returns
TryParse(string?, out DiscordPermission, bool, bool)
Converts the string representation of the name or numeric value of an DiscordPermission to the equivalent instance. The return value indicates whether the conversion succeeded.
public static bool TryParse(string? name, out DiscordPermission value, bool ignoreCase, bool allowMatchingMetadataAttribute)
Parameters
namestringThe string representation of the enumeration name or underlying value to convert
valueDiscordPermissionWhen this method returns, contains an object of type DiscordPermission whose value is represented by
valueif the parse operation succeeds. If the parse operation fails, contains the default value of the underlying type of DiscordPermission. This parameter is passed uninitialized.ignoreCasebooltrue to read value in case insensitive mode; false to read value in case sensitive mode.
allowMatchingMetadataAttributeboolIf true, considers the value included in EnumMemberAttribute attribute when parsing, otherwise only considers the member names.
Returns
TryParse(string?, out DiscordPermission, EnumParseOptions)
Converts the string representation of the name or numeric value of an DiscordPermission to the equivalent instance. The return value indicates whether the conversion succeeded.
public static bool TryParse(string? name, out DiscordPermission value, EnumParseOptions options)
Parameters
namestringThe string representation of the enumeration name or underlying value to convert
valueDiscordPermissionWhen this method returns, contains an object of type DiscordPermission whose value is represented by
valueif the parse operation succeeds. If the parse operation fails, contains the default value of the underlying type of DiscordPermission. This parameter is passed uninitialized.optionsEnumParseOptionsOptions that control how the string value should be parsed.
Returns
TryParse(in ReadOnlySpan<char>, out DiscordPermission)
Converts the span representation of the name or numeric value of an DiscordPermission to the equivalent instance. The return value indicates whether the conversion succeeded.
public static bool TryParse(in ReadOnlySpan<char> name, out DiscordPermission value)
Parameters
nameReadOnlySpan<char>The span representation of the enumeration name or underlying value to convert
valueDiscordPermissionWhen this method returns, contains an object of type DiscordPermission whose value is represented by
valueif the parse operation succeeds. If the parse operation fails, contains the default value of the underlying type of DiscordPermission. This parameter is passed uninitialized.
Returns
TryParse(in ReadOnlySpan<char>, out DiscordPermission, bool)
Converts the span representation of the name or numeric value of an DiscordPermission to the equivalent instance. The return value indicates whether the conversion succeeded.
public static bool TryParse(in ReadOnlySpan<char> name, out DiscordPermission value, bool ignoreCase)
Parameters
nameReadOnlySpan<char>The span representation of the enumeration name or underlying value to convert
valueDiscordPermissionWhen this method returns, contains an object of type DiscordPermission whose value is represented by
valueif the parse operation succeeds. If the parse operation fails, contains the default value of the underlying type of DiscordPermission. This parameter is passed uninitialized.ignoreCasebooltrue to read value in case insensitive mode; false to read value in case sensitive mode.
Returns
TryParse(in ReadOnlySpan<char>, out DiscordPermission, bool, bool)
Converts the span representation of the name or numeric value of an DiscordPermission to the equivalent instance. The return value indicates whether the conversion succeeded.
public static bool TryParse(in ReadOnlySpan<char> name, out DiscordPermission result, bool ignoreCase, bool allowMatchingMetadataAttribute)
Parameters
nameReadOnlySpan<char>The span representation of the enumeration name or underlying value to convert
resultDiscordPermissionWhen this method returns, contains an object of type DiscordPermission whose value is represented by
resultif the parse operation succeeds. If the parse operation fails, contains the default value of the underlying type of DiscordPermission. This parameter is passed uninitialized.ignoreCasebooltrue to read value in case insensitive mode; false to read value in case sensitive mode.
allowMatchingMetadataAttributeboolIf true, considers the value included in EnumMemberAttribute attribute when parsing, otherwise only considers the member names.
Returns
TryParse(in ReadOnlySpan<char>, out DiscordPermission, EnumParseOptions)
Converts the string representation of the name or numeric value of an DiscordPermission to the equivalent instance. The return value indicates whether the conversion succeeded.
public static bool TryParse(in ReadOnlySpan<char> name, out DiscordPermission result, EnumParseOptions options)
Parameters
nameReadOnlySpan<char>The string representation of the enumeration name or underlying value to convert
resultDiscordPermissionWhen this method returns, contains an object of type DiscordPermission whose value is represented by
resultif the parse operation succeeds. If the parse operation fails, contains the default value of the underlying type of DiscordPermission. This parameter is passed uninitialized.optionsEnumParseOptionsOptions that control how the string value should be parsed.