How to reverse a string in C# or VB.NET

To reverse a string in C# or VB.NET you can use the following snippet.

Sample C#

public string Reverse(string input)
    var arrayInput = input.ToCharArray();
    return new string(arrayInput);

Sample VB.NET

Public Function Reverse(input As String) As String
	Dim arrayInput = input.ToCharArray()
	Return New String(arrayInput)
End Function

for more informations take a look at the MSDN: Array.Reverse Method (Array)