Interface IOrderedDictionary<TKey, TValue>
Interface for a dictionary object that allows rapid hash lookups using keys, but also maintains the key insertion order so that values can be retrieved by key index.
Namespace: FlaxEngine.Collections
Assembly: FlaxEngine.CSharp.dll
Syntax
public interface IOrderedDictionary<TKey, TValue> : IDictionary<TKey, TValue>, ICollection<KeyValuePair<TKey, TValue>>, IEnumerable<KeyValuePair<TKey, TValue>>, IEnumerable, IOrderedDictionary, ICollection, IDictionary
Type Parameters
TKey
The type of keys in the dictionary. |
TValue
The type of values in the dictionary. |
Properties
Count
Gets the number of elements contained in the collection.
Declaration
int Count { get; }
Property Value
System.Int32
|
Item[TKey]
Gets or sets the element with the specified key.
Declaration
TValue this[TKey key] { get; set; }
Parameters
TKey
key
The key of the element to get or set. |
Property Value
TValue
The element with the specified key. |
Item[Int32]
Gets or sets the element at the specified index.
Declaration
TValue this[int index] { get; set; }
Parameters
System.Int32
index
The index of the element to get or set. |
Property Value
TValue
The element at the specified index. |
Keys
Gets the collection of the keys.
Declaration
ICollection<TKey> Keys { get; }
Property Value
System.Collections.Generic.ICollection<TKey>
|
Values
Gets the collection of the values.
Declaration
ICollection<TValue> Values { get; }
Property Value
System.Collections.Generic.ICollection<TValue>
|
Methods
Add(TKey, TValue)
Adds an element with the provided key and value to the collection.
Declaration
void Add(TKey key, TValue value)
Parameters
TKey
key
The object to use as the key of the element to add. |
TValue
value
The object to use as the value of the element to add. |
Clear()
Removes all items from the collection.
Declaration
void Clear()
ContainsKey(TKey)
Determines whether the dictionary contains the specified key.
Declaration
bool ContainsKey(TKey key)
Parameters
TKey
key
The key to check. |
Returns
System.Boolean
|
ContainsValue(TValue)
Determines whether the dictionary contains the specified value.
Declaration
bool ContainsValue(TValue value)
Parameters
TValue
value
The value to check. |
Returns
System.Boolean
|
ContainsValue(TValue, IEqualityComparer<TValue>)
Determines whether the dictionary contains the specified value.
Declaration
bool ContainsValue(TValue value, IEqualityComparer<TValue> comparer)
Parameters
TValue
value
The value to check. |
System.Collections.Generic.IEqualityComparer<TValue>
comparer
The equality comparer. |
Returns
System.Boolean
|
GetEnumerator()
Returns an enumerator that iterates through the collection.
Declaration
IEnumerator<KeyValuePair<TKey, TValue>> GetEnumerator()
Returns
System.Collections.Generic.IEnumerator<System.Collections.Generic.KeyValuePair<TKey, TValue>>
An enumerator that can be used to iterate through the collection. |
GetItem(Int32)
Gets the item at the specified index.
Declaration
KeyValuePair<TKey, TValue> GetItem(int index)
Parameters
System.Int32
index
The index. |
Returns
System.Collections.Generic.KeyValuePair<TKey, TValue>
The key-value pair. |
GetValue(TKey)
Gets the value by the key.
Declaration
TValue GetValue(TKey key)
Parameters
TKey
key
The key. |
Returns
TValue
The value. |
IndexOf(TKey)
Determines whether an element is in the collection.
Declaration
int IndexOf(TKey key)
Parameters
TKey
key
The object to locate in the current dictionary. The element to locate can be null for reference types. |
Returns
System.Int32
The index of the item. |
Insert(Int32, TKey, TValue)
Inserts the item at the specified index.
Declaration
void Insert(int index, TKey key, TValue value)
Parameters
System.Int32
index
The index. |
TKey
key
The object to use as the key of the element to add. |
TValue
value
The object to use as the value of the element to add. |
Remove(TKey)
Removes the element with the specified key from the collection.
Declaration
bool Remove(TKey key)
Parameters
TKey
key
The key of the element to remove. |
Returns
System.Boolean
true if the element is successfully removed; otherwise, false. This method also returns false if |
RemoveAt(Int32)
Removes the element at the specified index.
Declaration
void RemoveAt(int index)
Parameters
System.Int32
index
The zero-based index of the element to remove. |
SetItem(Int32, TValue)
Sets the value.
Declaration
void SetItem(int index, TValue value)
Parameters
System.Int32
index
The index. |
TValue
value
The value. |
SetValue(TKey, TValue)
Sets the 0 by the key.
Declaration
void SetValue(TKey key, TValue value)
Parameters
TKey
key
The key. |
TValue
value
The value. |
TryGetValue(TKey, out TValue)
Gets the value associated with the specified key.
Declaration
bool TryGetValue(TKey key, out TValue value)
Parameters
TKey
key
The key whose value to get. |
TValue
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 |
Returns
System.Boolean
true if the object that implements collection contains an element with the specified key; otherwise, false. |