title: How do I check to see if a list index exists in C#?
body: <p>I have the following snippet of code:</p>
  
  <pre><code>public static List&lt;string&gt; sqlData = new List&lt;string&gt;();
  
  //
  //  lots of code here
  //
  
  if (/* check here to see if the sqlData[whatever] index exists  */)
  {
      sqlData.Insert(count2, sqlformatted);
  }
  else
  {
      sqlData.Insert(count2, sqlformatted + sqlData[count2]);
  }
  </code></pre>
  
  <p>What I want to know is how to check the index on sqlData to see if it exists before trying to insert something that contains itself.</p>