Table of Contents

Class TwoDimensionalDictionary<TLevel0, TLevel1, TKey, TValue>

Namespace
Dynamicweb.Core
Assembly
Dynamicweb.Core.dll
Two dimensional dictionary.
[Serializable]
[DataContract]
public class TwoDimensionalDictionary<TLevel0, TLevel1, TKey, TValue> : IDictionary<TKey, TLevel1>, ICollection<KeyValuePair<TKey, TLevel1>>, IEnumerable<KeyValuePair<TKey, TLevel1>>, IEnumerable where TLevel0 : IDictionary<TKey, TLevel1>, new() where TLevel1 : IDictionary<TKey, TValue>, new()

Type Parameters

TLevel0
Toplevel dictionay containing keys and related dictioanries
TLevel1
Value-level dictionaries containing keys and related values
TKey
Value of the keys used in dictionaries
TValue
Type of values stored in object
Inheritance
TwoDimensionalDictionary<TLevel0, TLevel1, TKey, TValue>
Implements
IDictionary<TKey, TLevel1>
ICollection<KeyValuePair<TKey, TLevel1>>
IEnumerable<KeyValuePair<TKey, TLevel1>>
Inherited Members
Extension Methods

Constructors

TwoDimensionalDictionary()

Initializes an empty dictionary.
public TwoDimensionalDictionary()

Properties

Count

Contains the number of level 1 dictionaries in the level 0 dictionary
public int Count { get; }

Property Value

int

IsReadOnly

Tells if the level 0 dictionary is readonly
public bool IsReadOnly { get; }

Property Value

bool

this[TKey]

Setter and getter for level 0 dictonary
public TLevel1 this[TKey key] { get; set; }

Parameters

key TKey
Level 0 key

Property Value

TLevel1
value

Keys

Contains the keys of the level 0 dictionary
public ICollection<TKey> Keys { get; }

Property Value

ICollection<TKey>

Values

Contains the values of the level 0 dictionary
public ICollection<TLevel1> Values { get; }

Property Value

ICollection<TLevel1>

Methods

Add(TKey, TLevel1)

Adds the level 1 dictionary
public void Add(TKey key, TLevel1 value)

Parameters

key TKey
Level 0 key
value TLevel1
Level 1 dictionary

Add(KeyValuePair<TKey, TLevel1>)

Adds level 1 dictioanry based upon key
public void Add(KeyValuePair<TKey, TLevel1> item)

Parameters

item KeyValuePair<TKey, TLevel1>
KeyValue pair

Clear()

Clears all level 1 dictionaries.
public void Clear()

Contains(KeyValuePair<TKey, TLevel1>)

Returns if level 1 dictioanry is contained in the leve 0 dictionary.
public bool Contains(KeyValuePair<TKey, TLevel1> item)

Parameters

item KeyValuePair<TKey, TLevel1>
KeyValue of level 0 key and level 1 dictioanry

Returns

bool
containsLevel1Dictioanry

ContainsKey(TKey)

Returns if the level 0 dictionary contains the given key
public bool ContainsKey(TKey key)

Parameters

key TKey
Level 0 key

Returns

bool
hasKey

CopyTo(KeyValuePair<TKey, TLevel1>[], int)

Dictionary to array
public void CopyTo(KeyValuePair<TKey, TLevel1>[] array, int arrayIndex)

Parameters

array KeyValuePair<TKey, TLevel1>[]
Array
arrayIndex int
Starting point in array

GetEnumerator()

Geets the enumerator for the dictionary
public IEnumerator<KeyValuePair<TKey, TLevel1>> GetEnumerator()

Returns

IEnumerator<KeyValuePair<TKey, TLevel1>>

GetKeys(TKey)

Gets all level 1 keys for specific level 0 key.
public HashSet<TKey> GetKeys(TKey level0Key)

Parameters

level0Key TKey
Level 0 key

Returns

HashSet<TKey>

GetValue(TKey, TKey)

Gets the specified value.
public TValue GetValue(TKey level0Key, TKey level1Key)

Parameters

level0Key TKey
Level 0 key
level1Key TKey
Level 1 key

Returns

TValue
value

GetValues(TKey)

Gets all level 1 values for specific level 0 key.
public HashSet<TValue> GetValues(TKey level0Key)

Parameters

level0Key TKey
Level 0 key

Returns

HashSet<TValue>
values

Remove(TKey)

Removes the level 1 dictioanry with the level 0 key
public bool Remove(TKey key)

Parameters

key TKey
Level 0 key

Returns

bool
wasRemoved

Remove(TKey, TKey)

Removes the level 1 key from the level 1 dictionary.
public bool Remove(TKey level0Key, TKey level1Key)

Parameters

level0Key TKey
Level 0 key
level1Key TKey
Level 1 key

Returns

bool
wasRemoved

Remove(KeyValuePair<TKey, TLevel1>)

Removes level 1 dictioanry
public bool Remove(KeyValuePair<TKey, TLevel1> item)

Parameters

item KeyValuePair<TKey, TLevel1>
Keyvalue pair with level 0 key

Returns

bool
wasRemoved

SetValue(TKey, TKey, TValue)

Sets the value in the dictionary
public void SetValue(TKey level0Key, TKey level1Key, TValue level1Value)

Parameters

level0Key TKey
Level 0 key
level1Key TKey
Level 1 key
level1Value TValue
Value

SetValues(TKey, TLevel1)

Sets the stored level 1 dictionary for the specified level 0 key.
public void SetValues(TKey level0Key, TLevel1 level1)

Parameters

level0Key TKey
Level 0 key
level1 TLevel1
Level 1 dictionary

TryGetValue(TKey, out TLevel1)

TryGet for level 1 dictioanry based upon level 0 key
public bool TryGetValue(TKey key, out TLevel1 value)

Parameters

key TKey
Level 0 key
value TLevel1
Level 1 dictioanry

Returns

bool
wasFound

TryGetValue(TKey, TKey, out TValue)

Tries to get the specified value.
public bool TryGetValue(TKey level0Key, TKey level1Key, out TValue value)

Parameters

level0Key TKey
Level 0 key
level1Key TKey
Level 1 key
value TValue
Value from level 1

Returns

bool
hasValue
To top