Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
ジェネリッククラスに定義したstaticフィールドは型パラメータ毎に定義される。
void Main()
{
AClass<int>.Count.Dump();
AClass<string>.Count.Dump();
AClass<int>.Count++;
AClass<int>.Count.Dump();
AClass<string>.Count.Dump();
//
// 結果:
// 0
// 0
// 1
// 0
//
}
// Define other methods and classes here
public class AClass<T>
{
public static int Count = 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment