// Collection of code snippets by Arne Vajhøj // (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) using System; namespace E { public class A { private static Type sub = null; public A() { if(sub == null) { sub = this.GetType(); } else if(sub != this.GetType()) { throw new Exception("No no my friend"); } } } public class B : A { } public class C : A { } public class Program { public static void Main(string[] args) { new B(); new C(); } } }