C# Adding and subtracting to characters in a string
<p>I'm reading from a text file and trying to replace all characters with new ones. Depending on what character I read I want to add 13 to it or subtract 13. My problem is that once I change 'a' to 'n' it changes back to 'a' when I get to 'n' and try to subtract. For ex all 'a' should be 'n' and all 'n' should be 'a'.</p>

<pre><code>while ((inValue = inFile.ReadLine()) != null) {
    for (int letter = 'A'; letter &lt; 'z'; letter++)
    {
        if (letter &gt;= 'A' &amp;&amp; letter &lt;= 'M')
            inValue = inValue.Replace((char)letter, (char)    (letter + 13));
        else if (letter &gt;= 'N' &amp;&amp; letter &lt;= 'Z')
            inValue = inValue.Replace((char)letter, (char)(letter - 13));
        else if (letter &gt;= 'a' &amp;&amp; letter &lt;= 'm')
            inValue = inValue.Replace((char)letter, (char)(letter + 13));
        else if (letter &gt;= 'n' &amp;&amp; letter &lt;= 'z')
            inValue = inValue.Replace((char)letter, (char)(letter - 13));
    }
}
</code></pre>