Sunday, 10 February 2013

String Reverse in VB.NET using LINQ

String Reverse in VB.NET using LINQ


String reverse using LINQ in VB.NET
Reversing a string :String class has reverse method,
this Reverse method returns IEnumerable<char> so you need to convert it to an array of character.
String constructor accepts  array of characters as input param.

Shared Function StringReverse() As String
          Dim str As String =  "Hello World!"
          Console.WriteLine(str)
          str = New String(str.Reverse().ToArray())
          Console.WriteLine(str)
           Return str
 End Function

Output:  !dlroW olleH

Tags:String Reverse in VB.NET using LINQ, String.Reverse(),convert characters to an array,convert an array of characters to String,String reverse using LINQ,Reverse.ToArray()