This one should outperform both the other methods for longer strings because of the
StringBuilder
.
string s = "AbCdEfGhI§$%&/()1234567890";
var sb = new StringBuilder(s.Length);
foreach (char c in s)
sb.Append(char.IsUpper(c) ? char.ToLower(c) : char.ToUpper(c));
s = sb.ToString();
I have to admit I haven't tested it, but I'm pretty sure... :)
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.