static void Main(string[] args) { len = args.Length; arr = new string[len]; arr = args; bool flag = true; while (flag) { string input = ""; Console.WriteLine("1. ConsoleAry "); Console.WriteLine("2. ConsoleForEach1 "); Console.WriteLine("3. ConsoleAryForEach2 "); Console.WriteLine("4. ConsoleSort1"); Console.WriteLine("5. CC4512"); Console.WriteLine("6. CC4513"); Console.WriteLine("7. CC4514"); Console.WriteLine("8. CC4525"); Console.WriteLine("9. CC4526"); Console.WriteLine("10. CC4527"); Console.WriteLine("11. ReadArg"); Console.WriteLine("12. ConsoleAmount"); Console.WriteLine("13. ConsoleMethod1"); Console.WriteLine("14. ConsoleMethod2"); Console.WriteLine("15. ConsoleMethod3"); Console.WriteLine("16. ConsoleMethod4"); Console.WriteLine("17. CallValue"); Console.WriteLine("18. ConsoleByRef"); Console.WriteLine("19. ConsoleByOut"); Console.WriteLine("20. ConsoleGetMax"); Console.WriteLine("21. ConsoleOverLoads"); Console.WriteLine("22. ConsoleStaticVar"); Console.WriteLine("23. CC4511"); Console.WriteLine("------------------------"); Console.WriteLine("請輸入要執行的範例"); input = Console.ReadLine(); switch (input) { case "0": flag = false; break; case "1": ConsoleAry.consoleAry(); break; case "2": ConsoleForEach1.consoleForEach1(); break; case "3": ConsoleAryForEach2.consoleAryForEach2(); break; case "4": ConsoleSort1.consoleSort1(); break; case "5": CC4512.cC4512(); break; case "6": CC4513.cC4513(); break; case "7": CC4514.cC4514(); break; case "8": CC4525.cC4525(); break; case "9": CC4526.cC4526(); break; case "10": CC4527.cC4527(); break; case "11": Test.test(); break; case "12": ConsoleAmount.consoleAmount(); break; case "13": ConsoleMethod1.consoleMethod1(); break; case "14": ConsoleMethod2.consoleMethod2(); break; case "15": ConsoleMethod3.consoleMethod3(); break; case "16": ConsoleMethod4.consoleMethod4(); break; case "17": CallValue.callValue(); break; case "18": ConsoleByRef.consoleByRef(); break; case "19": ConsoleByOut.consoleByOut(); break; case "20": ConsoleGetMax.consoleGetMax(); break; case "21": ConsoleOverLoads.consoleOverLoads(); break; case "22": ConsoleStaticVar.consoleStaticVar(); break; case "23": CC4511.cC4511(); break; default: //flag = false; break; } Console.Clear(); } }
static void Main(string[] args) { len = args.Length; arr = new string[len]; arr = args; bool flag = true; while (flag) { Console.Clear(); string input = ""; Console.WriteLine("1. ConsoleAry"); Console.WriteLine("2. ConsoleAryForEach2"); Console.WriteLine("3. ConsoleForEach1"); Console.WriteLine("4. ConsoleAmount"); Console.WriteLine("5. ConsoleMethod1"); Console.WriteLine("6. ConsoleMethod2"); Console.WriteLine("7. ConsoleMethod3"); Console.WriteLine("8. ConsoleMethod4"); Console.WriteLine("9. ConsoleByVal"); Console.WriteLine("10. ConsoleByRef"); Console.WriteLine("11. ConsoleOut"); Console.WriteLine("12. ConsoleGetMax"); Console.WriteLine("13. ConsoleOverLoads"); Console.WriteLine("14. ConsoleStaticVar"); Console.WriteLine("66. text"); Console.WriteLine("======================"); Console.Write("請輸入要執行的範例 :"); input = Console.ReadLine(); switch (input) { case "0": flag = false; break; case "1": ConsoleAry.consoleary(); break; case "2": ConsoleAryForEach2.consolearyforeach2(); break; case "3": ConsoleForEach1.consoleforeach1(); break; case "4": ConsoleAmount.consoleamount(); break; case "5": ConsoleMethod1.consolemethod1(); break; case "6": ConsoleMethod2.consolemethod2(); break; case "7": ConsoleMethod3.consolemethod3(); break; case "8": ConsoleMethod4.consolemethod4(); break; case "9": ConsoleByVal.consolebyval(); break; case "10": ConsoleByRef.consolebyref(); break; case "11": ConsoleOutput.consoleoutput(); break; case "12": ConsoleGetMax.consolegetmax(); break; case "13": ConsoleOverLoads.consoleoverloads(); break; case "14": ConsoleStaticVar.consolestaticvar(); break; case "66": Test.test(); break; } } }