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
- bool
trueif the value parameter was converted successfully; otherwise,false.
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.ignoreCasebooltrueto read value in case insensitive mode;falseto read value in case sensitive mode.
Returns
- bool
trueif the value parameter was converted successfully; otherwise,false.
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.ignoreCasebooltrueto read value in case insensitive mode;falseto read value in case sensitive mode.allowMatchingMetadataAttributeboolIf
true, considers the value included in metadata attributes such as[Display]attribute when parsing, otherwise only considers the member names.
Returns
- bool
trueif the value parameter was converted successfully; otherwise,false.
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
- bool
trueif the value parameter was converted successfully; otherwise,false.
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.ignoreCasebooltrueto read value in case insensitive mode;falseto read value in case sensitive mode.
Returns
- bool
trueif the value parameter was converted successfully; otherwise,false.
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.ignoreCasebooltrueto read value in case insensitive mode;falseto read value in case sensitive mode.allowMatchingMetadataAttributeboolIf
true, considers the value included in metadata attributes such as[Display]attribute when parsing, otherwise only considers the member names.
Returns
- bool
trueif the value parameter was converted successfully; otherwise,false.