using System.Linq;publicclassKata{publicstaticboolIsPalindrome(object line){char[] str = line.ToString().ToCharArray();char[] reverseStr = str.Reverse<char>().ToArray();returnnewstring(str).Equals(newstring(reverseStr));}}
答案6:
using System;using System.Linq;publicclassKata{publicstaticboolIsPalindrome(object line){return line.ToString()==newString(line.ToString().ToCharArray().Reverse().ToArray());}}
答案7:
using System.Linq;publicclassKata{publicstaticboolIsPalindrome(object line){string s = line.ToString();returnstring.Join("",s.Reverse())==s;}}
答案8:
using System.Linq;publicclassKata{publicstaticboolIsPalindrome(object line){if(line.ToString()==newstring(line.ToString().Reverse().ToArray()))returntrue;returnfalse;}}
答案9:
using System.Linq;publicclassKata{publicstaticboolIsPalindrome(object line){string revObj =string.Join("", line.ToString().Reverse());return line.ToString()== revObj;}}
答案10:
using System.Linq;publicclassKata{publicstaticboolIsPalindrome(object line){string a = line.ToString();return a.SequenceEqual(a.Reverse());}}