title: Loop in Dictionary
body: <p>I use this:</p>
  
  <pre><code>foreach(KeyValuePair&lt;String,String&gt; entry in MyDic)
    {
        // do something with entry.Value or entry.Key
  
    }
  </code></pre>
  
  <p>The problem is that I can't change the value of entry.Value or entry.Key</p>
  
  <p>My question is that how can i change the value or key when looping through a dictionary?
  And, does dictionary allow duplicated key? And if yes, how can we avoid ?
  Thank you</p>