XML String index out of range
<p>I have this code:</p>

<pre><code>string Str = "&lt;String&gt;&lt;MoreString&gt;";
int Start = Str.LastIndexOf('&lt;') + 1;
int End = Str.IndexOf('&gt;', Start);
string S = Str.Substring(Start, End);
</code></pre>

<p>If Str is just <code>"&lt;String&gt;"</code>, then it works fine, but if Str is <code>"&lt;String&gt;&lt;MoreString&gt;"</code>, then it throws an index out of range error. Is it because of the "&lt;",">" characters?</p>
