Table of Contents

Class CommandCollection

Namespace
SixLabors.ImageSharp.Web.Commands
Assembly
SixLabors.ImageSharp.Web.dll

Represents an ordered collection of processing commands.

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
Inheritance
CommandCollection
Implements
Inherited Members
Extension Methods

Constructors

CommandCollection()

Initializes a new instance of the CommandCollection class.

public CommandCollection()

Properties

this[string]

Gets or sets the value associated with the specified key.

public string this[string key] { get; set; }

Parameters

key string

The key of the value to get or set.

Property Value

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

ArgumentNullException

key is null.

KeyNotFoundException

An element with the specified key does not exist in the collection.

Keys

Gets an IEnumerable<T> representing the keys of the collection.

public IEnumerable<string> Keys { get; }

Property Value

IEnumerable<string>

Methods

Add(string, string)

Adds an element with the provided key and value to the CommandCollection.

public void Add(string key, string value)

Parameters

key string

The string to use as the key of the element to add.

value string

The string to use as the value of the element to add.

Exceptions

ArgumentNullException

key is null.

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.

public int FindIndex(Predicate<string> match)

Parameters

match Predicate<string>

The Predicate<T> delegate that defines the conditions of the element to search for.

Returns

int

The zero-based index of the first occurrence of an element that matches the conditions defined by match, if found; otherwise, -1.

Exceptions

ArgumentNullException

match is null.

GetKeyForItem(KeyValuePair<string, string?>)

When implemented in a derived class, extracts the key from the specified element.

protected override string GetKeyForItem(KeyValuePair<string, string?> item)

Parameters

item KeyValuePair<string, string>

The element from which to extract the key.

Returns

string

The key for the specified element.

IndexOf(string)

Searches for the specified key and returns the zero-based index of the first occurrence within the entire CommandCollection.

public int IndexOf(string key)

Parameters

key string

The key to locate in the CommandCollection.

Returns

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.

public void Insert(int index, string key, string value)

Parameters

index int

The zero-based index at which item should be inserted.

key string

The string to use as the key of the element to insert.

value string

The string to use as the value of the element to insert.

Exceptions

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.

public bool TryGetValue(string key, out string? value)

Parameters

key string

The key whose value to get.

value string

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

bool

true if the object that implements CommandCollection contains an element with the specified key; otherwise, false.

Exceptions

ArgumentNullException

key is null.