Check if a String is a Palindrome
Checking whether a word is a palindrome can be done succinctly with LINQ.
string word = "radar"; bool isPalindrome = word.SequenceEqual(word.Reverse()); Console.WriteLine(isPalindrome);
Explanation: This code compares the original string with its reversed version using SequenceEqual. If they match, the string is a palindrome.