title: Updating List in ConcurrentDictionary
body: <p>So I have a IList as the value in my ConcurrentDictionary. </p>
  
  <pre><code>ConcurrentDictionary&lt;int, IList&lt;string&gt;&gt; list1 = new ConcurrentDictionary&lt;int, IList&lt;string&gt;&gt;;
  </code></pre>
  
  <p>In order to update a value in a list I do this:</p>
  
  <pre><code>if (list1.ContainsKey[key])
  {
    IList&lt;string&gt; templist;
    list1.TryGetValue(key, out templist);
    templist.Add("helloworld");
  }
  </code></pre>
  
  <p>However, does adding a string to <em>templist</em> update the ConcurrentDictionary? If so, is the update thread-safe so that no data corruption would occur?</p>
  
  <p>Or is there a better way to update or create a list inside the ConcurrentDictionary </p>
  
  <p><strong>EDIT</strong></p>
  
  <p>If I were to use a ConcurrentBag instead of a List, how would I implement this? More specifically, how could I update it? ConcurrentDictionary's TryUpdate method feels a bit excessive.</p>
  
  <p>Does ConcurrentBag.Add update the ConcurrentDictionary in a thread-safe mannar?</p>
  
  <pre><code>ConcurrentDictionary&lt;int, ConcurrentBag&lt;string&gt;&gt; list1 = new ConcurrentDictionary&lt;int, ConcurrentBag&lt;string&gt;&gt;
  </code></pre>