/ Published in: C#
URL: http://weblogs.sqlteam.com/mladenp/archive/2006/03/19/9350.aspx
Here's how to reverse a string in one line using C# and LINQ.
Expand |
Embed | Plain Text
using System; using System.Linq; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { // Reverse a string "Star Wars".ToCharArray().Reverse().ToList().ForEach(letter => Console.Write(letter)); } } }
You need to login to post a comment.
