String reverse in C# without reverse function code example

Example 1: c# reverse string

public static string ReverseString(string s)
    {
        char[] arr = s.ToCharArray();
        Array.Reverse(arr);
        return new string(arr);
    }

Example 2: c# reverse a string

public static void Main(string[] args)
        {
            string s = "aeiouXYZ";
           Console.Write(Reverse(s) );
        }

        public static string Reverse(string s)
        {
            var result = new string(s.ToCharArray().Reverse().ToArray() );
            return result;
        }
------------------------------------------------------Option 2
foreach (int v in values.Select(x => x).Reverse())
{
      Console.Write(v + " ");
}

Example 3: reverse string c#

string str = "Hello World!"; // the string which you want to reverse
string reverse = "";
int length = str.Length - 1; 

while(length >= 0)
{
	reverse += str[length];
   	length--;
}

Console.WriteLine(reverse);  // output: "!dlroW olleH"