reverse function in c# code example
Example 1: c# array Reverse method
char[] array = {'a','b','c'};
Array.Reverse(array);
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 + " ");
}