title: How to create a new Dictionary<,> from an IReadOnlyDictionary<,>?
body: <p>.NET 4.5 introduces the handy <code>IReadOnlyDictionary&lt;TKey, TValue&gt;</code> interface. A <code>Dictionary&lt;TKey, TValue&gt;</code> <em>is-an</em> <code>IReadOnlyDictionary&lt;TKey, TValue&gt;</code>, so I can just pass the former wherevert the latter is required.</p>
  
  <p>I'm not sure about the opposite way, though: <em>How do I create a new <code>Dictionary&lt;,&gt;</code> based on an existing <code>IReadOnlyDictionary&lt;,&gt;</code>?</em></p>
  
  <ul>
  <li><code>Dictionary&lt;,&gt;</code> has several constructors that take an <code>IDictionary&lt;,&gt;</code> -- but none that take an <code>IReadOnlyDictionary&lt;,&gt;</code>.</li>
  <li><code>IReadOnlyDictionary&lt;,&gt;</code> has an extension method <code>ToDictionary&lt;,&gt;()</code>. However, that's inherited from <code>IEnumerable&lt;&gt;</code>. So to use it, I have to pass two utterly redundant delegates like this: <code>readOnlyDict.ToDictionary(pair =&gt; pair.Key, pair =&gt; pair.Value)</code>. Ugly!</li>
  <li>Of course, I can always create a new <code>Dictionary&lt;,&gt;</code>, iterate over the original pairs and copy them over.</li>
  </ul>
  
  <p>It seems to me that there should be a trivial way to create a new <code>Dictionary&lt;,&gt;</code> based on an existing <code>IReadOnlyDictionary&lt;,&gt;</code>. Am I missing something?</p>
  
  <p><strong>Edit:</strong> Some clarification. I'm not looking for some magic way of treating an <code>IReadOnlyDictionary&lt;,&gt;</code> as a <code>Dictionary&lt;,&gt;</code>. I want to create a new <code>Dictionary&lt;,&gt;</code> that copies its initial values from an <code>IReadOnlyDictionary&lt;,&gt;</code>. This question is a long-winded way of asking:</p>
  
  <p><em><code>Dictionary&lt;,&gt;</code> has a convenience constructor to copy the initial values from an <code>IDictionary&lt;,&gt;</code>. How come it doesn't have one taking an <code>IReadOnlyDictionary&lt;,&gt;</code> and what's the most idiomatic way of achieving the same result?</em></p>