MultiValueDictionary
 All Classes Namespaces Files Functions Properties
Public Member Functions | Properties | List of all members
MyCollections.MultiValueDictionary< TKey, TValue > Class Template Reference

Multi-valued dictionary: Each key maps to a set of keys More...

Inherits IEquatable< MultiValueDictionary< TKey, TValue >>, and IEnumerable< KeyValuePair< TKey, ISet< TValue >>>.

Public Member Functions

override string ToString ()
 Returns a string representation of this MultiValueDictionary More...
 
bool Add (TKey key, TValue value)
 Adds new (key, value) pair to this MultiValueDictionary More...
 
ISet< TValue > Get (TKey key)
 Returns the set of values associated with this key More...
 
bool Remove (TKey key, TValue value)
 Removes a (key, value) pair from this dictionary. If the set of values is now empty, the key must be removed More...
 
bool ContainsKey (TKey key)
 Returns true if this dictionary contains the specified key More...
 
IEnumerator< KeyValuePair
< TKey, ISet< TValue > > > 
GetEnumerator ()
 Returns an enumerator over this dictionary More...
 
bool TryGetValue (TKey key, out ISet< TValue > values)
 Try to get the values associated with the specified key More...
 
int AddAll (ISet< TKey > keys, TValue value)
 For each key in keys add the (key, value) pair to the dictionary. More...
 
int RemoveAll (TValue value)
 Remove all occurrences of this value from the dictionary. If a value set becomes empty the associated key must be removed from the dictionary More...
 
bool Equals (MultiValueDictionary< TKey, TValue > other)
 Compares two MultiValueDictionary objects. Defined by the interface IEquatable<MultiValueDictionary<TKey, TValue>> More...
 
override bool Equals (object obj)
 Compares this dictionary to another object More...
 
override int GetHashCode ()
 Gets the hash code of this dictionary. If two dictionaries are equal they must have the same hash codes. More...
 

Properties

int Count [get]
 The number of keys in this MultiValueDictionary More...
 
ICollection< TKey > Keys [get]
 Read-only property. Gets all the keys from this dictionary More...
 
ICollection< ISet< TValue > > Values [get]
 Read-only property. Get all the values of this dictionary. More...
 

Detailed Description

Multi-valued dictionary: Each key maps to a set of keys

Template Parameters
TKeyThe type of the key
TValueThe type of the values

Member Function Documentation

bool MyCollections.MultiValueDictionary< TKey, TValue >.Add ( TKey  key,
TValue  value 
)

Adds new (key, value) pair to this MultiValueDictionary

Parameters
key
value
Returns
true if the (key, value) pair was added, false if it was a duplicate
Exceptions
ArgumentNullExceptionif key or value is null
int MyCollections.MultiValueDictionary< TKey, TValue >.AddAll ( ISet< TKey >  keys,
TValue  value 
)

For each key in keys add the (key, value) pair to the dictionary.

Parameters
keysthe keys
valuethe value
Returns
the number of elements added to this dictionary
Exceptions
ArgumentNullExceptionif keys or value is null
bool MyCollections.MultiValueDictionary< TKey, TValue >.ContainsKey ( TKey  key)

Returns true if this dictionary contains the specified key

Parameters
keythe key
Returns
true if this dictionary contains the specified key, false otherwise
bool MyCollections.MultiValueDictionary< TKey, TValue >.Equals ( MultiValueDictionary< TKey, TValue >  other)

Compares two MultiValueDictionary objects. Defined by the interface IEquatable<MultiValueDictionary<TKey, TValue>>

Parameters
otherthe dictionary to compare to
Returns
true if the dictionaries have the same keys, and for each key have the same values
override bool MyCollections.MultiValueDictionary< TKey, TValue >.Equals ( object  obj)

Compares this dictionary to another object

Parameters
objthe object to compare to
Returns
returns true if obj is a MultiValueDictionary which is equals to this dictionary
ISet<TValue> MyCollections.MultiValueDictionary< TKey, TValue >.Get ( TKey  key)

Returns the set of values associated with this key

Parameters
keythe key
Returns
the set of values associated with this key, or null if this key is not in the dictionary
Exceptions
ArgumentNullExceptionif key is null
IEnumerator<KeyValuePair<TKey, ISet<TValue> > > MyCollections.MultiValueDictionary< TKey, TValue >.GetEnumerator ( )

Returns an enumerator over this dictionary

Returns
an enumerator over this dictionary
override int MyCollections.MultiValueDictionary< TKey, TValue >.GetHashCode ( )

Gets the hash code of this dictionary. If two dictionaries are equal they must have the same hash codes.

Returns
bool MyCollections.MultiValueDictionary< TKey, TValue >.Remove ( TKey  key,
TValue  value 
)

Removes a (key, value) pair from this dictionary. If the set of values is now empty, the key must be removed

Parameters
keythe key
valuethe value
Returns
true if an element was removed
Exceptions
ArgumentNullExceptionif key or value is null
int MyCollections.MultiValueDictionary< TKey, TValue >.RemoveAll ( TValue  value)

Remove all occurrences of this value from the dictionary. If a value set becomes empty the associated key must be removed from the dictionary

Parameters
valuethe value to remove
Returns
the number of elements removed from this dictionary
Exceptions
ArgumentNullExceptionif value is nulll
override string MyCollections.MultiValueDictionary< TKey, TValue >.ToString ( )

Returns a string representation of this MultiValueDictionary

Returns
a string representation of this MultiValueDictionary
bool MyCollections.MultiValueDictionary< TKey, TValue >.TryGetValue ( TKey  key,
out ISet< TValue >  values 
)

Try to get the values associated with the specified key

Parameters
keythe key
valuesWhen this method returns, the value associated with the specified key, if the key is found; otherwise, the default value for the type of the value parameter. This parameter is passed uninitialized.
Returns
true if this dictionary contains an element with the specified key; otherwise, false.

Property Documentation

int MyCollections.MultiValueDictionary< TKey, TValue >.Count
get

The number of keys in this MultiValueDictionary

ICollection<TKey> MyCollections.MultiValueDictionary< TKey, TValue >.Keys
get

Read-only property. Gets all the keys from this dictionary

ICollection<ISet<TValue> > MyCollections.MultiValueDictionary< TKey, TValue >.Values
get

Read-only property. Get all the values of this dictionary.


The documentation for this class was generated from the following file: