static void Main(string[] args) { IDoThings myStuff; var done = false; do { Console.WriteLine("1. DoHickey"); Console.WriteLine("2. DoDickey"); Console.WriteLine("-----------"); Console.WriteLine("q. Stop program"); var choice = Console.ReadLine(); switch (choice) { case "q": done = true; continue; case "1": myStuff = new DoHickey(); break; case "2": myStuff = new DoDickey(); break; default: Console.WriteLine("Not valid input"); continue; } myStuff.DoNothing(); myStuff.DoSomething(1); myStuff.DoSomethingElse("Hello"); } while (!done); }
static void Main(string[] args) { string val; val = System.Console.ReadLine(); if (val == "1") { IDoThings myStuff = new DoHickey(); myStuff.DoNothing(); myStuff.DoSomething(5); myStuff.DoSomethingElse("Hello"); System.Console.WriteLine(""); } else if (val == "2") { IDoThings myDuff = new DoDickey(); myDuff.DoNothing(); myDuff.DoSomething(5); myDuff.DoSomethingElse("Hello"); System.Console.WriteLine(""); } else { System.Console.WriteLine("F**k off!"); System.Console.WriteLine(""); } }
static void Main(string[] args) { Console.WriteLine("Welcome to the program. Press 1 for DoHickey and 2 for DoDickey"); var input = Console.ReadLine(); if (input == "1") { IDoStuff myStuff = new DoHickey(); myStuff.DoNothing(); myStuff.DoSomething(2); myStuff.DoSomethingElse("Hej Hickey"); } else if (input == "2") { IDoStuff myStuff = new DoDickey(); myStuff.DoNothing(); myStuff.DoSomething(3); myStuff.DoSomethingElse("Hej Dickey"); } else { Console.WriteLine("You must choose 1 or 2!"); } Console.ReadLine(); }
static void Main(string[] args) { IDoThings myStuff; Console.WriteLine("Press H for DoHickey\nPress D for DoDickey"); ConsoleKeyInfo input = Console.ReadKey(); Console.WriteLine(""); if (char.ToUpper(input.KeyChar) == 'H') { myStuff = new DoHickey(); } else if (char.ToUpper(input.KeyChar) == 'D') { myStuff = new DoDickey(); } else { Console.WriteLine("Wrong input...\n"); return; } myStuff.DoNothing(); myStuff.DoSomething(4); myStuff.DoSomethingElse("Hej"); }
static void Main(string[] args) { IDoThings doHickey = new DoHickey(); doHickey.DoNothing(); doHickey.DoSomething(7); doHickey.DoSomethingElse("John Doe"); IDoThings doDickey = new DoDickey(); doDickey.DoNothing(); doDickey.DoSomething(7); doDickey.DoSomethingElse("John Doe"); }
static void Main(string[] args) { IDoThings myStuff = new DoHickey(); Console.WriteLine("Do you want to do dickey or hickey?\nIf dickey type in d or if hickey type in h:"); string input = Console.ReadLine(); if (input.Equals("d")) { myStuff = new DoDickey(); } myStuff.DoNothing(); myStuff.DoSomething(3); myStuff.DoSomethingElse("Hallo world"); Console.ReadLine(); }
static void Main(string[] args) { Console.WriteLine("Tryk 1 for Hickey og 2 for Dickey\n"); ConsoleKeyInfo key = Console.ReadKey(); if (key.KeyChar == '1') { IDoThings myStuff = new DoHickey(); } else { IDoThings myStuff = new DoDickey(); } myStuff.DoNothing(); myStuff.DoSomething(4); myStuff.DoSomethingElse("hej hej"); }