c# sort array
Array.Sort(arr);
c# sort array
int[] sortedCopy = from element in copyArray
orderby element ascending select element;
c# array sort and loop
// declaring and initializing the array
int[] arr = new int[] { 1, 9, 6, 7, 5, 9 };
// Sort array in ascending order.
Array.Sort(arr);
// reverse array
Array.Reverse(arr);
// print all element of array
// without Array.Reverse() - prints: 1 5 6 7 9 9
// with Array.Reverse() - prints: 9 9 7 6 5 1
foreach (int value in arr)
{
Console.Write(value + " ");
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us