title: C# - String IndexOf method with second argument equal to String length
body: <p>At some point in my code, I use this method:</p>
  
  <pre><code>IndexOf(string str, int startIndex)
  </code></pre>
  
  <p>I am also doing some calculations before, and I invoke this method with second argument (startIndex) equal to length of a string passed as first argument.
  Of course, no such an index exists in a string, and if we did something like this:</p>
  
  <pre><code>string[string.Length] 
  </code></pre>
  
  <p>we would get an <code>IndexOutOfRangeException</code></p>
  
  <p>How does that method work exactly? In MSDN documentation it is clearly said, that startIndex is zero-based index of a string. Does it work and doesn't throw because a char array that <code>String</code> class operates on is null-terminated?
  I want to make sure that my program won't throw at any point.</p>