C# Looping [Index was out of range]
<p>I have a Loop like this</p>

<pre><code>int numberofelements=20;

for(int i=0;i&lt;numberofelements;i++)
            {

                if(i==numberofelements)
                {
                    break;
                }

                if(i==i+1))
                {
                   //do some thing

                }else
                {
                  //do some thing else

                }

        }
</code></pre>

<p>As obvious this gives the runtime exception for the final element of the list: <code>Index was out of range. Must be non-negative and less than the size of the collection.</code></p>

<p>how do i handle this on the last element of this list not to check the condition <code>i==i+1</code>? </p>
