title: How to delete a chosen element in array?
body: <p>I have this assignment where I must delete a chosen element from an array, so I came up with this code:</p>
  
  <pre><code>strInput = Console.ReadLine();
  for (int i = 0; i &lt; intAmount; i++)
  {
      if (strItems[i] == strInput)
      {
          strItems[i] = null;
          for (int x = 0; x &lt; intAmount-i; x++)
          {
              i = i + 1;
              strItems[i - 1] = strItems[i];
          }
          intAmount = intAmount - 1;
      }
  }
  </code></pre>
  
  <p>The problem is that, suppose I have an array <code>[1,2,3,4,5,]</code>, and I want to delete <code>1</code>. The output would be <code>[2,3,4,5,5]</code>. This also happens when I choose <code>2</code>, but it does not happen when I choose any other number. </p>
  
  <p>What am I doing wrong?</p>