Class CommandCollection
Represents an ordered collection of processing commands.
Inheritance
Implements
Inherited Members
Namespace: SixLabors.ImageSharp.Web.Commands
Assembly: SixLabors.ImageSharp.Web.dll
Syntax
public sealed class CommandCollection : KeyedCollection<string, KeyValuePair<string, string?>>, IList<KeyValuePair<string, string?>>, ICollection<KeyValuePair<string, string?>>, IReadOnlyList<KeyValuePair<string, string?>>, IReadOnlyCollection<KeyValuePair<string, string?>>, IEnumerable<KeyValuePair<string, string?>>, IList, ICollection, IEnumerable
Constructors
| Edit this page View SourceCommandCollection()
Initializes a new instance of the CommandCollection class.
Declaration
public CommandCollection()
Properties
| Edit this page View Sourcethis[string]
Gets or sets the value associated with the specified key.
Declaration
public string this[string key] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
string | key | The key of the value to get or set. |
Property Value
Type | Description |
---|---|
string | The value associated with the specified key. If the specified key is not found, a get operation throws a KeyNotFoundException, and a set operation creates a new element with the specified key. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
KeyNotFoundException | An element with the specified key does not exist in the collection. |
Keys
Gets an IEnumerable<T> representing the keys of the collection.
Declaration
public IEnumerable<string> Keys { get; }
Property Value
Type | Description |
---|---|
IEnumerable<string> |
Methods
| Edit this page View SourceAdd(string, string)
Adds an element with the provided key and value to the CommandCollection.
Declaration
public void Add(string key, string value)
Parameters
Type | Name | Description |
---|---|---|
string | key | The string to use as the key of the element to add. |
string | value | The string to use as the value of the element to add. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
FindIndex(Predicate<string>)
Searches for an element that matches the conditions defined by the specified predicate, and returns the zero-based index of the first occurrence within the entire CommandCollection.
Declaration
public int FindIndex(Predicate<string> match)
Parameters
Type | Name | Description |
---|---|---|
Predicate<string> | match | The Predicate<T> delegate that defines the conditions of the element to search for. |
Returns
Type | Description |
---|---|
int | The zero-based index of the first occurrence of an element that matches the conditions defined by match, if found; otherwise, -1. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
GetKeyForItem(KeyValuePair<string, string?>)
When implemented in a derived class, extracts the key from the specified element.
Declaration
protected override string GetKeyForItem(KeyValuePair<string, string?> item)
Parameters
Type | Name | Description |
---|---|---|
KeyValuePair<string, string> | item | The element from which to extract the key. |
Returns
Type | Description |
---|---|
string | The key for the specified element. |
Overrides
| Edit this page View SourceIndexOf(string)
Searches for the specified key and returns the zero-based index of the first occurrence within the entire CommandCollection.
Declaration
public int IndexOf(string key)
Parameters
Type | Name | Description |
---|---|---|
string | key | The key to locate in the CommandCollection. |
Returns
Type | Description |
---|---|
int | The zero-based index of the first occurrence of key within the entire CommandCollection, if found; otherwise, -1. |
Insert(int, string, string)
Inserts an element into the CommandCollection at the specified index.
Declaration
public void Insert(int index, string key, string value)
Parameters
Type | Name | Description |
---|---|---|
int | index | The zero-based index at which item should be inserted. |
string | key | The string to use as the key of the element to insert. |
string | value | The string to use as the value of the element to insert. |
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | index is less than zero. -or- index is greater than CommandCollection.Count. |
TryGetValue(string, out string?)
Gets the value associated with the specified key.
Declaration
public bool TryGetValue(string key, out string? value)
Parameters
Type | Name | Description |
---|---|---|
string | key | The key whose value to get. |
string | value | When this method returns, the value associated with the specified key, if the key is found; otherwise, the default value for the type of the value parameter. This parameter is passed uninitialized. |
Returns
Type | Description |
---|---|
bool | true if the object that implements CommandCollection contains an element with the specified key; otherwise, false. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|