title: Method to verify a array string values?
body: <p>I have a method, I want to be able to verify a string array inside the method. But how would I do it if the string array increase and decrease by the amount of values for example one string might have 2 items, and the next might have 3 items in the string array??</p>
  
  <p>If I have a string that is more than what i have inside the method, i get error: System.IndexOutOfRangeException: Index was outside the bounds of the array. 
  Here's my method so far:</p>
  
  <pre><code>string1 = "item1, item2";
  string2 = "item01, item02, item03";
  
  private void VerifyArrayString(string theString)
  {
      var elements = theString.Splitnew[] { ',' }, System.StringSplitOptions.RemoveEmptyEntries);
      for(int i=0; i&lt;elements.Length; i +=1)
      {
         if(elements[0] != null)
         {
             //do something
         }
             if(elements[1] != null)
             {
                 //do something
             }
                 // and so and so with the next items....
      }
  }
  </code></pre>