Reverse A String in C#

Run Settings
LanguageC#
Language Version
Run Command
using System; using System.Collections.Generic; using System.Linq; class MainClass { static void Main() { Console.WriteLine(ReverseString("Hello World!")); } public static string ReverseString(string randomString) { if (string.IsNullOrEmpty(randomString) || randomString.Length < 2) return string.Empty; // char[] characters = randomString.ToCharArray(); char[] characters = new char[randomString.Length]; for (int i=0; i<characters.Length/2; i++) { characters[i] = randomString[characters.Length - 1 - i]; characters[characters.Length - 1 - i] = randomString[i]; } return new string(characters); } }
Editor Settings
Theme
Key bindings
Full width
Lines