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
name
stringThe case-sensitive string representation of the enumeration name or underlying value to convert
value
DiscordPermissionWhen this method returns, contains an object of type DiscordPermission whose value is represented by
value
if 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
true
if 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
name
stringThe string representation of the enumeration name or underlying value to convert
value
DiscordPermissionWhen this method returns, contains an object of type DiscordPermission whose value is represented by
value
if the parse operation succeeds. If the parse operation fails, contains the default value of the underlying type of DiscordPermission. This parameter is passed uninitialized.ignoreCase
booltrue
to read value in case insensitive mode;false
to read value in case sensitive mode.
Returns
- bool
true
if 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
name
stringThe string representation of the enumeration name or underlying value to convert
value
DiscordPermissionWhen this method returns, contains an object of type DiscordPermission whose value is represented by
value
if the parse operation succeeds. If the parse operation fails, contains the default value of the underlying type of DiscordPermission. This parameter is passed uninitialized.ignoreCase
booltrue
to read value in case insensitive mode;false
to read value in case sensitive mode.allowMatchingMetadataAttribute
boolIf
true
, considers the value included in metadata attributes such as[Display]
attribute when parsing, otherwise only considers the member names.
Returns
- bool
true
if 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
name
ReadOnlySpan<char>The span representation of the enumeration name or underlying value to convert
value
DiscordPermissionWhen this method returns, contains an object of type DiscordPermission whose value is represented by
value
if 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
true
if 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
name
ReadOnlySpan<char>The span representation of the enumeration name or underlying value to convert
value
DiscordPermissionWhen this method returns, contains an object of type DiscordPermission whose value is represented by
value
if the parse operation succeeds. If the parse operation fails, contains the default value of the underlying type of DiscordPermission. This parameter is passed uninitialized.ignoreCase
booltrue
to read value in case insensitive mode;false
to read value in case sensitive mode.
Returns
- bool
true
if 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
name
ReadOnlySpan<char>The span representation of the enumeration name or underlying value to convert
result
DiscordPermissionWhen this method returns, contains an object of type DiscordPermission whose value is represented by
result
if the parse operation succeeds. If the parse operation fails, contains the default value of the underlying type of DiscordPermission. This parameter is passed uninitialized.ignoreCase
booltrue
to read value in case insensitive mode;false
to read value in case sensitive mode.allowMatchingMetadataAttribute
boolIf
true
, considers the value included in metadata attributes such as[Display]
attribute when parsing, otherwise only considers the member names.
Returns
- bool
true
if the value parameter was converted successfully; otherwise,false
.