Skip to content

Instantly share code, notes, and snippets.

@TryJSIL
Created April 27, 2012 11:16
Show Gist options
  • Save TryJSIL/2508474 to your computer and use it in GitHub Desktop.
Save TryJSIL/2508474 to your computer and use it in GitHub Desktop.
Generic Nested Types
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