Пример #1
0
        static void Main(string[] args)
        {
            Console.WriteLine("------------ Original 'args'");
            for (int i = 0; i < args.Length; i++)
            {
                Console.WriteLine("args[{0}] = \"{1}\"", i, args[i]);
            }
            Console.WriteLine("----------------------------------------");
            Console.WriteLine("------------ GetOptions Processing");
            GetOptTestOptions options = new GetOptTestOptions();

            options.ProcessArgs(args);
            Console.WriteLine("----------------------------------------");
            Console.WriteLine("------------ Results");
            if (options.param != null)
            {
                Console.WriteLine("Parameters supplied for 'param' were:");
                foreach (string Parameter in options.param)
                {
                    Console.WriteLine("\t" + Parameter);
                }
            }
            for (int i = 0; i < options.RemainingArguments.Length; i++)
            {
                Console.WriteLine("remaining args[{0}] = \"{1}\"", i, options.RemainingArguments[i]);
            }
            Console.WriteLine("----------------------------------------");
        }
		static void Main(string[] args)
		{
			Console.WriteLine("------------ Original 'args'");
			for(int i = 0; i < args.Length; i++)
				Console.WriteLine("args[{0}] = \"{1}\"",i,args[i]);
			Console.WriteLine("----------------------------------------");
			Console.WriteLine("------------ GetOptions Processing");
			GetOptTestOptions options = new GetOptTestOptions(); 
			options.ProcessArgs(args);
			Console.WriteLine("----------------------------------------");
			Console.WriteLine("------------ Results");
			if (options.param != null)
			{
				Console.WriteLine("Parameters supplied for 'param' were:");
				foreach (string Parameter in options.param)
					Console.WriteLine("\t" + Parameter);
			}
			for(int i = 0; i < options.RemainingArguments.Length; i++)
				Console.WriteLine("remaining args[{0}] = \"{1}\"",i,options.RemainingArguments[i]);
			Console.WriteLine("----------------------------------------");
		}