Method TryConsume
TryConsume<T>(string, out T?)
Tries to consume (parse and remove) the entry with the specified key. Returns false if the key is not found or parsing fails. Transitions the collection to the Consuming state if it is not already.
Declaration
public bool TryConsume<T>(string key, out T? value) where T : IParsable<T>
Parameters
| Type | Name | Description |
|---|---|---|
| string | key | |
| T | value |
Returns
| Type | Description |
|---|---|
| bool |
Type Parameters
| Name | Description |
|---|---|
| T |
Exceptions
| Type | Condition |
|---|---|
| InvalidOperationException | The collection is in the Done state. |