Mega Code Archive

 
Categories / C# / Language Basics
 

Deal with the arguments

using System; class SayHello {     public static void Main(string[] args) {         if (args.Length > 0) {             foreach (string arg in args) {                 if (arg.Equals("/help"))                     Console.WriteLine("Run this program as follows: sayhello.exe [name1] ");                 else                     Console.WriteLine("Hello " + "{0}", arg);             }         } else             Console.WriteLine("For help, run sayhello.exe /help");     } }