Genericsとstatic fields

ふと思ったのだが、ジェネリクスの型パラメタだけが違うクローズ型のスタティックフィールドは共有されるのか、独立しているのか。当然のことながら独立していないと困ったことになるので、多分独立しているのだろうと思ったのだが物は試し。

public class Foo where T : class, new()
{
    static string staticField = "static field";
    static Foo()
    {
        Debug.WriteLine( "Foo<" + typeof(T).Name + "> called static constructor.");
        Debug.WriteLine( staticField );
        staticField = null;
    }
    public Foo()
    {}
}

public class Bar {}
public class Baz {}

class Program
{
    static void Main(string[] args)
    {
        Foo barFoo = new Foo;
        Foo bazFoo = new Foo;
    }
}

実行結果

Foo called static constructor.
static field
Foo called static constructor.
static field

知っている人には当たり前の結果だが、私としてはこれで納得。