Method TryGetValue
TryGetValue<T>(string, out T?)
Attempts to get the value associated with the specified key, parsed as the specified type using invariant culture formatting.
Declaration
public bool TryGetValue<T>(string key, out T? value) where T : IParsable<T>
Parameters
| Type | Name | Description |
|---|---|---|
| string | key | The query parameter key. |
| T | value | When this method returns, contains the parsed value if the key was found and parsing succeeded. |
Returns
| Type | Description |
|---|---|
| bool | true if the key was found and the value was successfully parsed; otherwise false. |
Type Parameters
| Name | Description |
|---|---|
| T | The type to parse the value as, which must implement IParsable<TSelf>. |
TryGetValue<T>(string, bool, out T?)
Attempts to get the value associated with the specified key, parsed as the specified type using invariant culture formatting, with control over whether parsing errors should be treated as missing keys.
Declaration
public bool TryGetValue<T>(string key, bool throwOnParseError, out T? value) where T : IParsable<T>
Parameters
| Type | Name | Description |
|---|---|---|
| string | key | The query parameter key. |
| bool | throwOnParseError | If true, a FormatException is thrown when parsing fails; otherwise, parsing errors are treated as missing keys. |
| T | value | When this method returns, contains the parsed value if the key was found and parsing succeeded. |
Returns
| Type | Description |
|---|---|
| bool | true if the key was found and the value was successfully parsed; otherwise false. |
Type Parameters
| Name | Description |
|---|---|
| T | The type to parse the value as, which must implement IParsable<TSelf>. |
TryGetValue<T>(string, out bool, out T?)
Attempts to get the value associated with the specified key, parsed as the specified type using invariant culture formatting.
Declaration
public bool TryGetValue<T>(string key, out bool foundKey, out T? value) where T : IParsable<T>
Parameters
| Type | Name | Description |
|---|---|---|
| string | key | The query parameter key. |
| bool | foundKey | When this method returns, indicates whether the key was found. |
| T | value | When this method returns, contains the parsed value if the key was found and parsing succeeded. |
Returns
| Type | Description |
|---|---|
| bool | true if the key was found and the value was successfully parsed; otherwise false. |
Type Parameters
| Name | Description |
|---|---|
| T | The type to parse the value as, which must implement IParsable<TSelf>. |