title: Getting parameters after argument in command line
body: <p>Hi so I am trying to get the two values after user input --dimensions.</p>
  <p>For example when I do: <code>dotnet app.dll --dimensions 1 2</code> (In command line)</p>
  <p>It prints</p>
  <pre><code>1
  2
  </code></pre>
  <p>Which is the result I'm after.</p>
  <p>But when I do: <code>dotnet app.dll --test --dimensions 1 2</code></p>
  <p>It returns <code>hi</code>, meaning that <code>--test</code> worked. But returns an error for <code>--dimensions</code></p>
  <pre><code>hi
  Unhandled exception. System.FormatException: Input string was not in a correct format.
     at System.Number.ThrowOverflowOrFormatException(ParsingStatus status, TypeCode type)
     at System.String.System.IConvertible.ToInt32(IFormatProvider provider)
     at System.Convert.ToInt32(Object value)
     at MainClass.Main(String[] args)
  </code></pre>
  <p>I don't want the argument to only work if its the first argument given. That is why I added <code>--test</code> before <code>--dimensions</code></p>
  <p>I want it to work when the argument <code>--dimensions</code> is placed anywhere.</p>
  <p>For example <code>dotnet app.dll --test --test --dimensions 1 2 --test</code></p>
  <p>Which should return</p>
  <pre><code>hi
  hi
  1
  2
  hi
  </code></pre>
  <p>Im new with this as well :( Sorry.</p>
  <p>Code:</p>
  <pre><code>using System;
  
  class MainClass
  {
      private static int value1, value2;
      static void Main(string[] args)
      {
          foreach (string value in args)
          {
              int for_dimensions = 0;
  
              string testing = &quot;--test&quot;;
  
              if (value == &quot;--dimensions&quot; &amp;&amp; args.Length &gt;= for_dimensions + 2)
              {
                  object test1 = args.GetValue(for_dimensions+1);
                  value1 = Convert.ToInt32(test1);
                      
                  object test2 = args.GetValue(for_dimensions + 2);
                  value2 = Convert.ToInt32(test2);
  
                  Console.WriteLine(value1);
                  Console.WriteLine(value2);
              }
  
              if (value == testing)
              {
                  Console.WriteLine(&quot;hi&quot;);
              }
              
          }
          
      }
  }
  </code></pre>
  <p>Thank you</p>