1: using System;
2: using System.Collections.Generic;
3: using System.Linq;
4: using System.Text;
5:
6: namespace ConsoleApplication1
7: {
8: class Program
9: {
10: static void main(string[] args)
11: {
12: int Value1 = 0;
13: int Value2 = 32;
14: int ArgumentProcessedCount = 0;
15: foreach (string s in args)
16: {
17: if (s.IndexOfAny(new string[] { "Value1" }) == 0)
18: {
19: Value1 = int.Parse(s.Split(":")[1]);
20: if (Value1 > 100)
21: break; // exit the for loop: evaluate no further arguments.
22: }
23: else if (s.IndexOfAny(new string[] { "Value2" }) == 0)
24: {
25: if (Value1 > 50) continue; // ignore this value: evaluate the next argument.
26: Value2 = int.Parse(s.Split(":")[1]);
27: }
28: else continue;
29: ArgumentProcessedCount++;
30: }
31: Console.WriteLine("Value1:{0}, Value2:{1}, ArgumentProcessedCount:{2}", Value1, Value2, ArgumentProcessedCount);
32: }
33: }
34: }