/// <summary> /// Runs the demo. /// </summary> /// <typeparam name="TDemo">The type of the demo.</typeparam> private static void RunDemo <TDemo>() where TDemo : class, IDemo { TDemo demo = Activator.CreateInstance <TDemo>(); demo.Run(); }
static void RunDemo <TDemo>() where TDemo : DemoBase, new() { Console.WriteLine($"Start {typeof(TDemo).Name}..."); using (TDemo demo = new TDemo()) { demo.Run(); } ConsoleHelper.WriteLineAndReadKey($"End {typeof(TDemo).Name}..."); }