title: A Dictionary containing dictionaries with ObservableCollection values that have different entity types
body: <p>I'm trying to implement a class in a Silverlight 4 RIA Services application that manages different ObservableCollections that are used for data binding. These ObservableCollections need to be identified by a string name and an integer classID, which I have implemented by nesting Dictionary objects in a Dictionary> object. The problem is, if I have explicit Entity types (which I do), this structure does not seem to work. The problem seems to occur when I am trying to put an ObservableCollection into an ObservableCollection (my guess as to how a generic entity list would be implemented).</p>
  
  <p>For example:</p>
  
  <pre><code>  this.rawData = new Dictionary&lt;int, ObservableCollection&lt;DataRaw&gt;&gt;();
    this.constData = new Dictionary&lt;int, ObservableCollection&lt;SystemConstant&gt;&gt;();
  
    this.masterData = new Dictionary&lt;string, Dictionary&lt;int, ObservableCollection&lt;Entity&gt;&gt;&gt;();
  
    masterData.Add("test", rawData);  &lt;--- ERROR OCCURS HERE, 'best overloaded method has invalid arguments'
  </code></pre>
  
  <p>Note that I have tried using 'Object' instead of 'Entity' in the instantiation of masterData, but that did not solve the problem (it was admittedly a feeble attempt).</p>
  
  <p>Thanks in advance for your insights. If there is a much better pattern I could be implementing here, I am open to being flexible. I mainly want to avoid having to code a bunch of Entity-type specific logic to manage the updating of this class. It seems like this should be generalizable.</p>
  
  <p>Alex</p>