Created
April 21, 2015 03:59
-
-
Save devlights/2d006dd93c22ced88585 to your computer and use it in GitHub Desktop.
ジェネリッククラスに定義したstaticフィールドは型パラメータ毎に定義される。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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