title: Dilemma in calling constructor of generic class
body: <p>I have this generic singleton that looks like this:</p>
  
  <pre><code>public class Cache&lt;T&gt;
  {
      private Dictionary&lt;Guid, T&gt; cachedBlocks;
  
      // Constructors and stuff, to mention this is a singleton
  
      public T GetCache(Guid id)
      {
          if (!cachedBlocks.ContainsKey(id))
              cachedBlocks.Add(id, LoadFromSharePoint(id))
          return cachedBlocks[id];
      }
  
      public T LoadFromSharePoint(Guid id)
      {
          return new T(id)    // Here is the problem.
      }
  }
  </code></pre>
  
  <p>The error message is:</p>
  
  <blockquote>
    <p>Cannot create an instance of type T because it does not have the new() constraint.</p>
  </blockquote>
  
  <p>I have to mention that I <em>must</em> pass that <code>id</code> parameter, and there is no other way to do so. Any ideas on how to solve this would be highly appreciated.</p>