How can i sort DESC and ASC in list generic?
- by Phsika
How can I sort DESC and ASC in a generic list? With LINQ and without LINQ ? I'm using vs 2008.
class Program
{
static void Main(string[] args)
{
List<int> li = new List<int>();
li.Add(456);
li.Add(123);
li.Add(12345667);
li.Add(0);
li.Add(1);
li.Sort();
foreach (int item in li)
{
Console.WriteLine(item.ToString()+"\n");
}
Console.ReadKey();
}
}