title: How can I cast a object which is instantiated by reflection to its real type?
body: <p>Recently I'm developing a tiny framework for myself, <br>
  and I met this problem:<br>
  How can I do things like follow:</p>
  
  <pre><code>void object CreateDictionary(Type dictionaryType)
  {
      object dict = dictionaryType.GetConstructor(new Type[] {}).Invoke(new object[] {});
      // Cast dict to its real type here so that I can add key-value-pairs to it.
      ...
  }
  </code></pre>
  
  <p>The dictionaryType is the type of some kind of Dictionary, and is got via reflection.<br>
  I have no idea about the full type because I don't know the generic attributes until runtime.</p>
  
  <p>I've also tried changing the declaration <code>object dict</code> to <code>var dict</code>, but it does not work either.</p>