How can i sort DESC and ASC in list generic?
Posted
by Phsika
on Stack Overflow
See other posts from Stack Overflow
or by Phsika
Published on 2010-06-17T14:24:17Z
Indexed on
2010/06/17
14:33 UTC
Read the original article
Hit count: 197
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();
}
}
© Stack Overflow or respective owner