Converting Dictionary<TKey, List<TValue>> to ReadOnlyDictionary<TKey, ReadOnlyCollection<TValue>>
<p>I have a dictionary as follows:</p>

<pre><code>public enum Role { Role1, Role2, Role3, }
public enum Action { Action1, Action2, Action3, }

var dictionary = new Dictionary&lt;Role, List&lt;Action&gt;&gt;();

dictionary.Add(RoleType.Role1, new Action [] { Action.Action1, Action.Action2 }.ToList());
</code></pre>

<p>Now I want to be able to construct a read-only dictionary whose value type is also read-only as follows:</p>

<pre><code>var readOnlyDictionary = new ReadOnlyDictionary&lt;Role, ReadOnlyCollection&lt;Action&gt;&gt;(dictionary);
</code></pre>

<p>The last line obviously causes a compile-time error due to the differences in <code>TValue</code> types.</p>

<p>Using a <code>List&lt;TValue&gt;</code> is also necessary since the original dictionary is programatically populated from an external source.</p>

<p>Is there an easy way to perform this conversion?</p>