If the values have nothing to do with the type of the generic base class, then they shouldn't be in the generic base class. They should either be in a completely separate class, or in a non-generic base class of the generic class.
Bear in mind that for static variables, you get a different static variable per type argument combination:
using System;
public class GenericType<TFirst, TSecond>
{
// Never use a public mutable field normally, of course.
public static string Foo;
}
public class Test
{
static void Main()
{
// Assign to different combination
GenericType<string,int>.Foo = "string,int";
GenericType<int,Guid>.Foo = "int,Guid";
GenericType<int,int>.Foo = "int,int";
GenericType<string,string>.Foo = "string,string";
// Verify that they really are different variables
Console.WriteLine(GenericType<string,int>.Foo);
Console.WriteLine(GenericType<int,Guid>.Foo);
Console.WriteLine(GenericType<int,int>.Foo);
Console.WriteLine(GenericType<string,string>.Foo);
}
}
It sounds like you don't really want a different static variable per T
of your generic base class - so you can't have it in your generic base class.