In C# I have a generic class:
public class MyGeneric where ParameterClass: MyGenericParameterClass, new() {
public static int Varia
No, it is not. Generic types can be "open" or "closed." An open type is one like List where the type parameter isn't defined; List is a closed type.
Essentially, the open type isn't treated as a proper "Type" by the runtime - only the closed versions are true types. So, MyGeneric and MyGeneric are two entirely different types, and thus have their own instances of the static variable.
This is made more obvious by the fact that you can't call your static member in the way you suggest: MyGeneric.Variable will not compile in C#.
This console application code illustrates it quite simply:
class Program
{
static void Main(string[] args)
{
Test.i = 2;
Test.i = 8;
Console.WriteLine(Test.i); // would write "8" if the fields were shared
Console.WriteLine(Test.i);
// Console.WriteLine(Test.i); // does not compile
// Console.WriteLine(Test<>.i); // does not compile
}
}
class Test
{
public static int i;
}