Static List within a Generic Class
<p>I have the following code (a simple example of a more complex project) where I have a static 'master' list of object typed lists.</p>

<p>If you step through the code I was expecting that when the second referenceManager3 type is created, via the constructor, that the _masterList would then contain both the String and Object lists. However it does not.</p>

<p>I assume this is due to the fact that each instance of ReferenceManager3 are actually different class types because of the generic type definition. Am I correct in thinking that?</p>

<p>How can I make this work?</p>

<pre class="lang-cs prettyprint-override"><code>class Program
{
    static void Main(string[] args)
    {
        ReferenceManager3&lt;string&gt; StringManager = new ReferenceManager3&lt;string&gt;();
        ReferenceManager3&lt;object&gt; IntManager = new ReferenceManager3&lt;object&gt;();
    }
}

class ReferenceManager3&lt;T&gt; where T : class //IReferenceTracking
{
    // Static list containing a reference to all Typed Lists
    static List&lt;IList&gt; _masterList = new List&lt;IList&gt;();

    // Object Typed List
    private List&lt;T&gt; _list = null;

    public ReferenceManager3()
    {
        // Create the new Typed List
        _list = new List&lt;T&gt;();

        // Add it to the Static Master List
        _masterList.Add(_list); // &lt;&lt;&lt; break here on the second call.
    }
}
</code></pre>