Skip to content

PseudoSerializableDictionary

Eric Lowry edited this page Aug 7, 2024 · 1 revision

Namespace: Lowry.Utils.CodeExtensions

public sealed class PseudoSerializableDictionary<TKey, TValue>

💡General Information

InputLayers makes use of a serializable "dictionary", which consists instead of a List of keys and a List of values kept in sync.

This "dictionary" functions a lot like a typical C# Dictionary🔗.

📄Properties

Keys

public List<TKey> Keys { get {...}, set {...} }

Stores the TKey keys of the dictionary.

Values

public List<TValue> Values { get {...}, set {...} }

Stores the TValue values of the dictionary.

Count

public int Count { get {...} }

Returns: the number of elements currently in the dictionary.

📄Methods

Set(TKey, TValue)

public void Set (TKey key, TValue value) {...}

Assigns a value to a specific key in the dictionary.

Set(KeyValuePair<TKey, TValue>)

public void Set (KeyValuePair<TKey, TValue> pair) {...}

Adds a KeyValuePair direcly to the dictionary.

Remove(TKey)

public void Set (TKey key, TValue value) {...}

Removes the entry at a specific key from the dictionary.

Returns: true if the key was found and removed.

Remove(KeyValuePair<TKey, TValue>)

public void Set (KeyValuePair<TKey, TValue> pair) {...}

Removes the entry at a specific KeyValuePair's key from the dictionary.

Returns: true if the KeyValuePair's key was found and removed.

RemoveAt(int)

public void RemoveAt (int id) {...}

Removes the entry at a specific id in the dictionary.

Returns: true if the id was found and removed.

Contains(TKey)

public void Contains (TKey key) {...}

Returns: true if the key was found in the dictionary.

Contains(KeyValuePair<TKey, TValue>)

public void Contains (KeyValuePair<TKey, TValue> pair) {...}

Returns: true if the KeyValuePair's key was found in the dictionary.

Clear()

public void Clear () {...}

Clears the contents of the dictionary.

At(int)

public TValue At (int id) {...}

Returns: the TValue found at the position id in dictionary or default if the id is ut of bounds.

At(TKey)

public TValue At (TKey key) {...}

Returns: the TValue corresponding to the TKey in dictionary or throws an ArgumentOutOfRangeException if the TKey cannot be found in the dictionary.

Clone this wiki locally