Summer.Batch.Common.Collections.OrderedDictionary< TKey, TValue > Class Template Reference

Dictionary that preserves the insertion order during enumeration. More...

Inheritance diagram for Summer.Batch.Common.Collections.OrderedDictionary< TKey, TValue >:

Public Member Functions

 OrderedDictionary (IEqualityComparer< TKey > comparer)
 Constructs a new OrderedDictionary<TKey,TValue> with the specified comparer and the default capacity. More...
 
 OrderedDictionary (int capacity=0, IEqualityComparer< TKey > comparer=null)
 Constructs a new OrderedDictionary<TKey,TValue> with the specified capacity and comparer. More...
 
bool TryGetValue (TKey key, out TValue value)
 Gets the value associated with the specified key. More...
 
bool ContainsKey (TKey key)
 Returns whether the dictionary contains the specified key. More...
 
void Add (TKey key, TValue value)
 Adds a new entry with the specified key and value into the dictionary. More...
 
bool Remove (TKey key)
 Removes the entry with the specified key from the dictionary. More...
 
void Clear ()
 Clears the dictionary. More...
 
IEnumerator< KeyValuePair< TKey, TValue > > GetEnumerator ()
 Returns an enumerator over pairs in this dictionary More...
 
void GetObjectData (SerializationInfo info, StreamingContext context)
 Adds the proper information for serialization. More...
 

Protected Member Functions

 OrderedDictionary (SerializationInfo info, StreamingContext context)
 Constructor for deserialization. More...
 

Properties

TValue this[TKey key] [get, set]
 Gets or sets a value for the specified key. More...
 
int Count [get]
 Gets the number pairs in the dictionary. More...
 
bool IsReadOnly [get]
 Always returns false, as this implementation is not read only. More...
 
ICollection< TKey > Keys [get]
 Gets the collection of keys in the correct order. More...
 
ICollection< TValue > Values [get]
 Gets the collection of values in the correct order. More...
 

Detailed Description

Dictionary that preserves the insertion order during enumeration.

Template Parameters
TKey The type of keys in the dictionary.
TValue The type of values in the dictionary.

Constructor & Destructor Documentation

Summer.Batch.Common.Collections.OrderedDictionary< TKey, TValue >.OrderedDictionary ( IEqualityComparer< TKey >  comparer)

Constructs a new OrderedDictionary<TKey,TValue> with the specified comparer and the default capacity.

Parameters
comparerComparer to use when comparing keys
Summer.Batch.Common.Collections.OrderedDictionary< TKey, TValue >.OrderedDictionary ( int  capacity = 0,
IEqualityComparer< TKey >  comparer = null 
)

Constructs a new OrderedDictionary<TKey,TValue> with the specified capacity and comparer.

Parameters
capacityInitial number of elements that the dictionary can contain.
comparerComparer to use when comparing keys
Exceptions
ArgumentOutOfRangeException capacity is less than 0
Summer.Batch.Common.Collections.OrderedDictionary< TKey, TValue >.OrderedDictionary ( SerializationInfo  info,
StreamingContext  context 
)
protected

Constructor for deserialization.

Parameters
infothe info holding the serialization data
contextthe serialization context

Member Function Documentation

void Summer.Batch.Common.Collections.OrderedDictionary< TKey, TValue >.Add ( TKey  key,
TValue  value 
)

Adds a new entry with the specified key and value into the dictionary.

Parameters
keyThe key to add.
valueThe value to add.
void Summer.Batch.Common.Collections.OrderedDictionary< TKey, TValue >.Clear ( )

Clears the dictionary.

bool Summer.Batch.Common.Collections.OrderedDictionary< TKey, TValue >.ContainsKey ( TKey  key)

Returns whether the dictionary contains the specified key.

Parameters
keyThe key to check.
Returns
whether the key exists in the dictionary.
IEnumerator<KeyValuePair<TKey, TValue> > Summer.Batch.Common.Collections.OrderedDictionary< TKey, TValue >.GetEnumerator ( )

Returns an enumerator over pairs in this dictionary

Returns
The enumerator
void Summer.Batch.Common.Collections.OrderedDictionary< TKey, TValue >.GetObjectData ( SerializationInfo  info,
StreamingContext  context 
)

Adds the proper information for serialization.

Parameters
infothe info holding the serialization data
contextthe serialization context
bool Summer.Batch.Common.Collections.OrderedDictionary< TKey, TValue >.Remove ( TKey  key)

Removes the entry with the specified key from the dictionary.

Parameters
keyThe key to remove
Returns
whether the key was found in the dictionary and an actual removal happened
Exceptions
ArgumentNullException if key is null
bool Summer.Batch.Common.Collections.OrderedDictionary< TKey, TValue >.TryGetValue ( TKey  key,
out TValue  value 
)

Gets the value associated with the specified key.

Parameters
keyThe key of the value to get.
valueContains the value associated with the specified key, if the key is found.
Returns
Whether the key is found.

Property Documentation

Gets the number pairs in the dictionary.

The number pairs in the dictionary.

bool Summer.Batch.Common.Collections.OrderedDictionary< TKey, TValue >.IsReadOnly
get

Always returns false, as this implementation is not read only.

false.

ICollection<TKey> Summer.Batch.Common.Collections.OrderedDictionary< TKey, TValue >.Keys
get

Gets the collection of keys in the correct order.

A collection of keys in the correct order.

TValue Summer.Batch.Common.Collections.OrderedDictionary< TKey, TValue >.this[TKey key]
getset

Gets or sets a value for the specified key.

Parameters
keyThe key to get or set.
Returns
The value for the specified key or null if it does not exist.
ICollection<TValue> Summer.Batch.Common.Collections.OrderedDictionary< TKey, TValue >.Values
get

Gets the collection of values in the correct order.

A collection of values in the correct order.


The documentation for this class was generated from the following file:
  • Summer.Batch.Common/Collections/OrderedDictionary.cs