title: Clarification of Read and Write on a C# Dictionary
body: <p>In the context of this statement,</p>
  
  <blockquote>
    <p>A Dictionary can support
    multiple readers concurrently, as long
    as the collection is not modified.
    Even so, enumerating through a
    collection is intrinsically not a
    thread-safe procedure. In the rare
    case where an enumeration contends
    with write accesses, the collection
    must be locked during the entire
    enumeration. To allow the collection
    to be accessed by multiple threads for
    reading and writing, you must
    implement your own synchronization.</p>
  </blockquote>
  
  <p>What does read and write mean? My understanding is that a read is an operation which looks up a key and provides a reference to it's value and a write is an operation which adds or removes a key value pair from the dictionary. However, I can't find anything conclusive that regarding this.</p>
  
  <p>So the big question is, while implementing a thread safe dictionary, would an operation that updates the value for an existing key in the dictionary be consider a reader or writer? I plan to have multiple threads accessing unique keys in a dictionary and modifying their values, but the threads will not add/remove new keys. </p>
  
  <p>The obvious implication, assuming modifying an existing value is not a write operation on the dictionary, is that my implementation of the thread safe dictionay can be a lot more efficient, as I would not need to get an exclusive lock every time I try to update the value to an existing key. </p>
  
  <p>Usage of ConcurrentDictionary from .Net 4.0 is not an option. </p>