Sunday 27 April 2014

Dictionary in C#


Category
Features
Name Space
Inherits from
IDictionary
1.      IDictionary implementations fall into three categories: read-only, fixed-size, variable-size.
ICollection
IDictionary<TKey, TValue>
1.      The IDictionary<TKey, TValue> interface is the base interface for generic collections of key/value pairs.
2.      IDictionary is a "more generic" type .
ICollection<KeyValuePair<TKey, TValue>
Dictionary
This implementation does not provide a synchronized (thread-safe) wrapper for a DictionaryBase, but derived classes can create their own synchronized versions. Solution: Lock collection to avoid changes made by other threads
 
IDictionary
Dictionary<TKey, TValue>
1.      Provides a mapping from a set of keys to a set of values.
2.      Retrieving a value by using its key is very fast because class is implemented as a hash table.
3.      A Dictionary<TKey, TValue> can support multiple readers concurrently, as long as the collection is not modified.
 
IDictionary<TKey, TValue>

No comments:

Post a Comment