C# Array Sort(T[])
Description
Array Sort (T[])
sorts the elements in an entire
Array using the IComparable generic interface implementation of each
element of the Array.
Syntax
Array.Sort<T>(T[])
has the following syntax.
public static void Sort<T>(
T[] array
)
Parameters
Array.Sort<T>(T[])
has the following parameters.
T
- The type of the elements of the array.array
- The one-dimensional, zero-based Array to sort.
Returns
Array.Sort<T>(T[])
method returns
Example
using System;/*from w ww . jav a 2 s . c om*/
using System.Collections.Generic;
public class Example
{
public static void Main()
{
string[] myValues = {"2016",
"1999",
"2001",
"2000",
"2002",
"2003"};
Array.Sort(myValues);
}
}
The code above generates the following result.