Sort Array using the IComparable generic interface implementation of each element of the Array in CSharp
Description
The following code shows how to sort Array using the IComparable generic interface implementation of each element of the Array.
Example
using System;//from www . j a v a2 s.c o m
using System.Collections.Generic;
public class Example
{
public static void Main()
{
string[] myValues = {"2016",
"1999",
"2001",
"2000",
"2002",
"2003"};
Array.Sort(myValues);
foreach(String s in myValues){
Console.WriteLine(s);
}
}
}
The code above generates the following result.