Interface IOrderedDictionary<TKey, TValue>
- Namespace
- Renci.SshNet
- Assembly
- Renci.SshNet.dll
Represents a collection of key/value pairs that are accessible by the key or index.
public interface IOrderedDictionary<TKey, TValue> : IDictionary<TKey, TValue>, ICollection<KeyValuePair<TKey, TValue>>, IReadOnlyDictionary<TKey, TValue>, IReadOnlyCollection<KeyValuePair<TKey, TValue>>, IEnumerable<KeyValuePair<TKey, TValue>>, IEnumerable where TKey : notnullType Parameters
TKey-
The type of the keys in the dictionary.
TValue-
The type of the values in the dictionary.
Implements
Properties
Count
Gets the number of key/value pairs contained in the Renci.SshNet.IOrderedDictionary`2.
int Count { get; }Property Value
Keys
Gets a collection containing the keys in the Renci.SshNet.IOrderedDictionary`2.
ICollection<TKey> Keys { get; }Property Value
- ICollection<TKey>
Values
Gets a collection containing the values in the Renci.SshNet.IOrderedDictionary`2.
ICollection<TValue> Values { get; }Property Value
- ICollection<TValue>
this[TKey]
Gets or sets the value associated with the specified key.
TValue this[TKey key] { get; set; }Property Value
- TValue
Remarks
Setting the value of an existing key does not impact its order in the collection.
Exceptions
- ArgumentNullException
-
keyis null. - KeyNotFoundException
-
The property is retrieved and
keydoes not exist in the collection.
Methods
ContainsKey(TKey)
Determines whether the Renci.SshNet.IOrderedDictionary`2 contains the specified key.
bool ContainsKey(TKey key)Parameters
keyTKey-
The key to locate in the Renci.SshNet.IOrderedDictionary`2.
Returns
- bool
-
true if the Renci.SshNet.IOrderedDictionary`2 contains an element with the specified key; otherwise, false.
Exceptions
- ArgumentNullException
-
keyis null.
ContainsValue(TValue)
Determines whether the Renci.SshNet.IOrderedDictionary`2 contains a specific value.
bool ContainsValue(TValue value)Parameters
valueTValue-
The value to locate in the Renci.SshNet.IOrderedDictionary`2. The value can be null for reference types.
Returns
- bool
-
true if the Renci.SshNet.IOrderedDictionary`2 contains an element with the specified value; otherwise, false.
GetAt(int)
Gets the key/value pair at the specified index.
KeyValuePair<TKey, TValue> GetAt(int index)Parameters
indexint-
The zero-based index of the pair to get.
Returns
- KeyValuePair<TKey, TValue>
-
The element at the specified index.
Exceptions
- ArgumentOutOfRangeException
-
indexis less than 0 or greater than or equal to Renci.SshNet.IOrderedDictionary`2.Count.
IndexOf(TKey)
Determines the index of a specific key in the Renci.SshNet.IOrderedDictionary`2.
int IndexOf(TKey key)Parameters
keyTKey-
The key to locate.
Returns
- int
-
The index of
keyif found; otherwise, -1.
Exceptions
- ArgumentNullException
-
keyis null.
Insert(int, TKey, TValue)
Inserts an item into the collection at the specified index.
void Insert(int index, TKey key, TValue value)Parameters
indexint-
The zero-based index at which item should be inserted.
keyTKey-
The key to insert.
valueTValue-
The value to insert.
Exceptions
- ArgumentNullException
-
keyis null. - ArgumentException
-
An element with the same key already exists in the Renci.SshNet.IOrderedDictionary`2.
- ArgumentOutOfRangeException
-
indexis less than 0 or greater than Renci.SshNet.IOrderedDictionary`2.Count.
Remove(TKey, out TValue)
Removes the value with the specified key from the Renci.SshNet.IOrderedDictionary`2 and copies the element to the value parameter.
bool Remove(TKey key, out TValue value)Parameters
keyTKey-
The key of the element to remove.
valueTValue-
The removed element.
Returns
Exceptions
- ArgumentNullException
-
keyis null.
RemoveAt(int)
Removes the key/value pair at the specified index.
void RemoveAt(int index)Parameters
indexint-
The zero-based index of the item to remove.
Exceptions
- ArgumentOutOfRangeException
-
indexis less than 0 or greater than or equal to Renci.SshNet.IOrderedDictionary`2.Count.
SetAt(int, TKey, TValue)
Sets the key/value pair at the specified index.
void SetAt(int index, TKey key, TValue value)Parameters
indexint-
The zero-based index at which to set the key/value pair.
keyTKey-
The key to store at the specified index.
valueTValue-
The value to store at the specified index.
Exceptions
- ArgumentNullException
-
keyis null. - ArgumentException
-
An element with the same key already exists at an index different to
index. - ArgumentOutOfRangeException
-
indexis less than 0 or greater than or equal to Renci.SshNet.IOrderedDictionary`2.Count.
SetAt(int, TValue)
Sets the value for the key at the specified index.
void SetAt(int index, TValue value)Parameters
indexint-
The zero-based index at which to set the key/value pair.
valueTValue-
The value to store at the specified index.
Exceptions
- ArgumentOutOfRangeException
-
indexis less than 0 or greater than or equal to Renci.SshNet.IOrderedDictionary`2.Count.
SetPosition(int, int)
Moves an existing key/value pair to the specified index in the collection.
void SetPosition(int index, int newIndex)Parameters
indexint-
The current zero-based index of the key/value pair to move.
newIndexint-
The zero-based index at which to set the key/value pair.
Exceptions
- ArgumentOutOfRangeException
-
indexornewIndexare less than 0 or greater than or equal to Renci.SshNet.IOrderedDictionary`2.Count.
SetPosition(TKey, int)
Moves an existing key/value pair to the specified index in the collection.
void SetPosition(TKey key, int newIndex)Parameters
keyTKey-
The key to move.
newIndexint-
The zero-based index at which to set the key/value pair.
Exceptions
- KeyNotFoundException
-
The specified key does not exist in the collection.
- ArgumentOutOfRangeException
-
newIndexis less than 0 or greater than or equal to Renci.SshNet.IOrderedDictionary`2.Count.
TryAdd(TKey, TValue)
Adds the specified key and value to the dictionary if the key doesn't already exist.
bool TryAdd(TKey key, TValue value)Parameters
keyTKey-
The key of the element to add.
valueTValue-
The value of the element to add. The value can be null for reference types.
Returns
- bool
-
true if the key didn't exist and the key and value were added to the dictionary; otherwise, false.
Exceptions
- ArgumentNullException
-
keyis null.
TryAdd(TKey, TValue, out int)
Adds the specified key and value to the dictionary if the key doesn't already exist.
bool TryAdd(TKey key, TValue value, out int index)Parameters
keyTKey-
The key of the element to add.
valueTValue-
The value of the element to add. The value can be null for reference types.
indexint-
The index of the added or existing
key. This is always a valid index into the dictionary.
Returns
- bool
-
true if the key didn't exist and the key and value were added to the dictionary; otherwise, false.
Exceptions
- ArgumentNullException
-
keyis null.
TryGetValue(TKey, out TValue)
Gets the value associated with the specified key.
bool TryGetValue(TKey key, out TValue value)Parameters
keyTKey-
The key of the value to get.
valueTValue-
When this method returns, contains the value associated with the specified key, if the key is found; otherwise, the default value for the type of the value parameter.
Returns
- bool
-
true if the Renci.SshNet.IOrderedDictionary`2 contains an element with the specified key; otherwise, false.
Exceptions
- ArgumentNullException
-
keyis null.
TryGetValue(TKey, out TValue, out int)
Gets the value associated with the specified key.
bool TryGetValue(TKey key, out TValue value, out int index)Parameters
keyTKey-
The key of the value to get.
valueTValue-
When this method returns, contains the value associated with the specified key, if the key is found; otherwise, the default value for the type of the value parameter.
indexint-
The index of
keyif found; otherwise, -1.
Returns
- bool
-
true if the Renci.SshNet.IOrderedDictionary`2 contains an element with the specified key; otherwise, false.
Exceptions
- ArgumentNullException
-
keyis null.