KS.Unity.ksSerializableDictionary< Key, Value > Class Template Reference

A dictionary that implements ISerializationCallbackReceiver for serializing key value data. More...

Inheritance diagram for KS.Unity.ksSerializableDictionary< Key, Value >:
KS.Unity.ksISerializableDictionary

Public Member Functions

 ksSerializableDictionary ()
 Constructor More...
 
 ksSerializableDictionary (ICollection< KeyValuePair< Key, Value >> keyValues)
 Constructor More...
 
void Add (Key key, Value value)
 Adds a key/value pair to the dictionary. More...
 
bool ContainsKey (Key key)
 Checks if a key is in the dictionary. More...
 
bool ContainsValue (Value value)
 Checks if a value is in the dictionary. More...
 
bool Remove (Key key)
 Removes a key from the dictionary. More...
 
bool TryGetValue (Key key, out Value value)
 Tries to get the value for a key from the dictionary. More...
 
void Clear ()
 Clears the dictionary. See Dictionary<TKey, TValue>.Clear. More...
 
IEnumerator< KeyValuePair< Key, Value > > GetEnumerator ()
 Enumerates the key/value pairs in the dictionary. More...
 

Properties

ICollection< Key > Keys [get]
 Key collection. More...
 
ICollection< Value > Values [get]
 Value collection. More...
 
int Count [get]
 The number of key/value pairs in the dictionary. More...
 
bool IsReadOnly [get]
 Is the dictionary read-only? More...
 
Value this[Key key] [get, set]
 Gets or sets the value associated with a key. More...
 

Detailed Description

A dictionary that implements ISerializationCallbackReceiver for serializing key value data.

Constructor & Destructor Documentation

◆ ksSerializableDictionary() [1/2]

◆ ksSerializableDictionary() [2/2]

KS.Unity.ksSerializableDictionary< Key, Value >.ksSerializableDictionary ( ICollection< KeyValuePair< Key, Value >>  keyValues)

Constructor

Parameters
keyValuesKey value pairs to populate the dictionary with.

Member Function Documentation

◆ Add()

void KS.Unity.ksSerializableDictionary< Key, Value >.Add ( Key  key,
Value  value 
)

Adds a key/value pair to the dictionary.

Throws an exception if the key is already in the dictionary. See Dictionary<TKey, TValue>.Add(TKey, TValue).

Parameters
keyKey to add.
valueValue to add.

◆ Clear()

void KS.Unity.ksSerializableDictionary< Key, Value >.Clear ( )

Clears the dictionary. See Dictionary<TKey, TValue>.Clear.

◆ ContainsKey()

bool KS.Unity.ksSerializableDictionary< Key, Value >.ContainsKey ( Key  key)

Checks if a key is in the dictionary.

See Dictionary<TKey, TValue>.ContainsKey(TKey).

Parameters
keyKey to check for.
Returns
True if the key is in the dictionary.

◆ ContainsValue()

bool KS.Unity.ksSerializableDictionary< Key, Value >.ContainsValue ( Value  value)

Checks if a value is in the dictionary.

See Dictionary<TKey, TValue>.ContainsValue(TValue).

Parameters
valueValue to check for.
Returns
True if the value is in the dictionary.

◆ GetEnumerator()

IEnumerator<KeyValuePair<Key, Value> > KS.Unity.ksSerializableDictionary< Key, Value >.GetEnumerator ( )

Enumerates the key/value pairs in the dictionary.

Returns
Enumerator

◆ Remove()

bool KS.Unity.ksSerializableDictionary< Key, Value >.Remove ( Key  key)

Removes a key from the dictionary.

See Dictionary<TKey, TValue>.Remove(TKey).

Parameters
keyKey to remove.
Returns
True if the key was removed from the dictionary. False if the key was not in the dictionary.

◆ TryGetValue()

bool KS.Unity.ksSerializableDictionary< Key, Value >.TryGetValue ( Key  key,
out Value  value 
)

Tries to get the value for a key from the dictionary.

See Dictionary<TKey, TValue>.TryGetValue(TKey, out TValue).

Parameters
keyKey to get value for.
valueThe value for the key.
Returns
True if the key was in the dictionary.

Property Documentation

◆ Count

int KS.Unity.ksSerializableDictionary< Key, Value >.Count
get

The number of key/value pairs in the dictionary.

◆ IsReadOnly

bool KS.Unity.ksSerializableDictionary< Key, Value >.IsReadOnly
get

Is the dictionary read-only?

◆ Keys

ICollection<Key> KS.Unity.ksSerializableDictionary< Key, Value >.Keys
get

Key collection.

◆ this[Key key]

Value KS.Unity.ksSerializableDictionary< Key, Value >.this[Key key]
getset

Gets or sets the value associated with a key.

Parameters
keyKey
Returns
The value for the key.

◆ Values

ICollection<Value> KS.Unity.ksSerializableDictionary< Key, Value >.Values
get

Value collection.