There's no need to compare each character of the
string
separately:
public static bool IsPalindrome(string str, StringComparison comparisonType)
{
if (string.IsNullOrEmpty(str)) return false;
string str2 = new string(str.Reverse().ToArray());
return string.Equals(str, str2, comparisonType);
}
public static bool IsPalindrome(string str)
{
return IsPalindrome(str, StringComparison.OrdinalIgnoreCase);
}