Last active
December 14, 2015 06:39
-
-
Save PeteGoo/5043985 to your computer and use it in GitHub Desktop.
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
a: | |
b: | |
setting a = a1 | |
a: a1 | |
b: | |
setting b = b1 | |
a: a1 | |
b: b1 | |
setting a = b1 | |
a: a2 | |
b: b1 | |
setting b = b2 | |
a: a2 | |
b: b2 |
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
class Program { | |
static void Main(string[] args) { | |
WriteValues(); | |
Console.WriteLine("setting a = a1"); | |
Foo<int>.SharedValue = "a1"; | |
WriteValues(); | |
Console.WriteLine("setting b = b1"); | |
Foo<string>.SharedValue = "b1"; | |
WriteValues(); | |
Console.WriteLine("setting a = a2"); | |
Foo<int>.SharedValue = "a2"; | |
WriteValues(); | |
Console.WriteLine("setting b = b2"); | |
Foo<string>.SharedValue = "b2"; | |
WriteValues(); | |
} | |
private static void WriteValues() { | |
Console.WriteLine("a: {0}", Foo<int>.SharedValue); | |
Console.WriteLine("b: {0}", Foo<string>.SharedValue); | |
} | |
} | |
internal class Foo<T> { | |
public static string SharedValue = ""; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment