Sunday, 27 January 2013

Reverse a string and sentence Linq Query


A string Reverse
string yString = "String to reverse";                
string rString = yString.Reverse().ToString(); 
Sentence reverse with each word in it...
string rString = string.Join(" ",from s in yString.Split(' ')
                                  select new String(s.Reverse().ToArray()));

No comments:

Post a Comment