TMap<TKey, TValue>

Namespace: UAssetAPI.UnrealTypes

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.

public class TMap<TKey, TValue> : IOrderedDictionary`2, , , , System.Collections.IEnumerable, System.Collections.Specialized.IOrderedDictionary, System.Collections.IDictionary, System.Collections.ICollection

Type Parameters

TKey

TValue

Inheritance ObjectTMap<TKey, TValue>
Implements IOrderedDictionary<TKey, TValue>, IDictionary<TKey, TValue>, ICollection<KeyValuePair<TKey, TValue>>, IEnumerable<KeyValuePair<TKey, TValue>>, IEnumerable, IOrderedDictionary, IDictionary, ICollection

Properties

Item

public TValue Item { get; set; }

Property Value

TValue

Item

public TValue Item { get; set; }

Property Value

TValue

Count

Gets the number of items in the dictionary

public int Count { get; }

Property Value

Int32

Keys

Gets all the keys in the ordered dictionary in their proper order.

public ICollection<TKey> Keys { get; }

Property Value

ICollection<TKey>

Values

Gets all the values in the ordered dictionary in their proper order.

public ICollection<TValue> Values { get; }

Property Value

ICollection<TValue>

Comparer

Gets the key comparer for this dictionary

public IEqualityComparer<TKey> Comparer { get; private set; }

Property Value

IEqualityComparer<TKey>

Constructors

TMap()

public TMap()

TMap(IEqualityComparer<TKey>)

public TMap(IEqualityComparer<TKey> comparer)

Parameters

comparer IEqualityComparer<TKey>

TMap(IOrderedDictionary<TKey, TValue>)

public TMap(IOrderedDictionary<TKey, TValue> dictionary)

Parameters

dictionary IOrderedDictionary<TKey, TValue>

TMap(IOrderedDictionary<TKey, TValue>, IEqualityComparer<TKey>)

public TMap(IOrderedDictionary<TKey, TValue> dictionary, IEqualityComparer<TKey> comparer)

Parameters

dictionary IOrderedDictionary<TKey, TValue>

comparer IEqualityComparer<TKey>

TMap(IEnumerable<KeyValuePair<TKey, TValue>>)

public TMap(IEnumerable<KeyValuePair<TKey, TValue>> items)

Parameters

items IEnumerable<KeyValuePair<TKey, TValue>>

TMap(IEnumerable<KeyValuePair<TKey, TValue>>, IEqualityComparer<TKey>)

public TMap(IEnumerable<KeyValuePair<TKey, TValue>> items, IEqualityComparer<TKey> comparer)

Parameters

items IEnumerable<KeyValuePair<TKey, TValue>>

comparer IEqualityComparer<TKey>

Methods

Add(TKey, TValue)

Adds the specified key and value to the dictionary.

public void Add(TKey key, TValue value)

Parameters

key TKey
The key of the element to add.

value TValue
The value of the element to add. The value can be null for reference types.

Clear()

Removes all keys and values from this object.

public void Clear()

Insert(Int32, TKey, TValue)

Inserts a new key-value pair at the index specified.

public void Insert(int index, TKey key, TValue value)

Parameters

index Int32
The insertion index. This value must be between 0 and the count of items in this object.

key TKey
A unique key for the element to add

value TValue
The value of the element to add. Can be null for reference types.

IndexOf(TKey)

Gets the index of the key specified.

public int IndexOf(TKey key)

Parameters

key TKey
The key whose index will be located

Returns

Int32
Returns the index of the key specified if found. Returns -1 if the key could not be located.

ContainsValue(TValue)

Determines whether this object contains the specified value.

public bool ContainsValue(TValue value)

Parameters

value TValue
The value to locate in this object.

Returns

Boolean
True if the value is found. False otherwise.

ContainsValue(TValue, IEqualityComparer<TValue>)

Determines whether this object contains the specified value.

public bool ContainsValue(TValue value, IEqualityComparer<TValue> comparer)

Parameters

value TValue
The value to locate in this object.

comparer IEqualityComparer<TValue>
The equality comparer used to locate the specified value in this object.

Returns

Boolean
True if the value is found. False otherwise.

ContainsKey(TKey)

Determines whether this object contains the specified key.

public bool ContainsKey(TKey key)

Parameters

key TKey
The key to locate in this object.

Returns

Boolean
True if the key is found. False otherwise.

GetItem(Int32)

Returns the KeyValuePair at the index specified.

public KeyValuePair<TKey, TValue> GetItem(int index)

Parameters

index Int32
The index of the KeyValuePair desired

Returns

KeyValuePair<TKey, TValue>

Exceptions

ArgumentOutOfRangeException

        Thrown when the index specified does not refer to a KeyValuePair in this object

SetItem(Int32, TValue)

Sets the value at the index specified.

public void SetItem(int index, TValue value)

Parameters

index Int32
The index of the value desired

value TValue
The value to set

Exceptions

ArgumentOutOfRangeException

        Thrown when the index specified does not refer to a KeyValuePair in this object

GetEnumerator()

Returns an enumerator that iterates through all the KeyValuePairs in this object.

public IEnumerator<KeyValuePair<TKey, TValue>> GetEnumerator()

Returns

IEnumerator<KeyValuePair<TKey, TValue>>

Remove(TKey)

Removes the key-value pair for the specified key.

public bool Remove(TKey key)

Parameters

key TKey
The key to remove from the dictionary.

Returns

Boolean
True if the item specified existed and the removal was successful. False otherwise.

RemoveAt(Int32)

Removes the key-value pair at the specified index.

public void RemoveAt(int index)

Parameters

index Int32
The index of the key-value pair to remove from the dictionary.

GetValue(TKey)

Gets the value associated with the specified key.

public TValue GetValue(TKey key)

Parameters

key TKey
The key associated with the value to get.

Returns

TValue

SetValue(TKey, TValue)

Sets the value associated with the specified key.

public void SetValue(TKey key, TValue value)

Parameters

key TKey
The key associated with the value to set.

value TValue
The the value to set.

TryGetValue(TKey, TValue&)

Tries to get the value associated with the specified key.

public bool TryGetValue(TKey key, TValue& value)

Parameters

key TKey
The key of the desired element.

value TValue&

        When this method returns, contains the value associated with the specified key if
        that key was found.  Otherwise it will contain the default value for parameter's type.
        This parameter should be provided uninitialized.

Returns

Boolean
True if the value was found. False otherwise.

Remarks:

SortKeys()

public void SortKeys()

SortKeys(IComparer<TKey>)

public void SortKeys(IComparer<TKey> comparer)

Parameters

comparer IComparer<TKey>

SortKeys(Comparison<TKey>)

public void SortKeys(Comparison<TKey> comparison)

Parameters

comparison Comparison<TKey>

SortValues()

public void SortValues()

SortValues(IComparer<TValue>)

public void SortValues(IComparer<TValue> comparer)

Parameters

comparer IComparer<TValue>

SortValues(Comparison<TValue>)

public void SortValues(Comparison<TValue> comparison)

Parameters

comparison Comparison<TValue>