C# Compiler error with Substring
<p>Why I'm getting: </p>

<pre><code>Index and length must refer to a location within the string.
Parameter name: length
</code></pre>

<p>when I compile this code:
<a href="http://pastebin.com/CW4EcCM8" rel="nofollow">http://pastebin.com/CW4EcCM8</a></p>

<p>some part of it:</p>

<pre><code>    public string findFileEnding(string file)
    {
        int index1 = file.IndexOf('.');
        file = file.Substring(index1, file.Length);
        return file;
    }
</code></pre>

<p>Thanks;)</p>
