Reverse a string in C#

Reverse a string in C#

using System;

public class Program
{
    public static void Main()
    {
        Console.WriteLine("Hello World");
        Console.WriteLine("Enter the string to reverse :");
        string name = Console.ReadLine();
        char[] namesArray = name.ToCharArray();
        Array.Reverse(namesArray);
        string nameReverse = new string(namesArray);
        Console.WriteLine(nameReverse);
    }
}
DEMO
Reverse a string in C# Reverse a string in C# Reviewed by Bhaumik Patel on 8:24 AM Rating: 5