Click here to Skip to main content
15,902,817 members
Articles / Programming Languages / C#

To check string is palindrome or not in .NET (C#)

Rate me:
Please Sign up or sign in to vote.
4.67/5 (4 votes)
7 Feb 2011CPOL 9.7K   2  
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,...

Views

Daily Counts

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer
United States United States
I’m a Software Engineer at Microsoft working on the Azure Portal. Before that I spent about 20 years developed various business applications at a number of different companies. I have a passion for writing clean, scalable code and sharing what I’ve learned with others.

I also help run the Casco Bay .Net User Group

Comments and Discussions