Created
April 27, 2012 11:16
-
-
Save TryJSIL/2508474 to your computer and use it in GitHub Desktop.
Generic Nested Types
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
using System; | |
public class Program { | |
public static void Main (string[] args) { | |
Console.WriteLine( | |
Battlestar<object>.instance.commander | |
); | |
} | |
} | |
class Battlestar<T> { | |
public string commander; | |
public static Battlestar<T> instance; | |
class Galactica : Battlestar<T> { | |
public Galactica () { | |
commander = "Adama"; | |
} | |
} | |
static Battlestar() { | |
Console.WriteLine(".cctor " + typeof(T)); | |
instance = new Galactica(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment