Ordenar arrays com C#

quinta-feira, 26 maio 2011 14:50 por leolima77

Ordene arrays com C# de uma forma fácil

string[] fileNames = Directory.GetFiles("*.*");

var sort = from fn in fileNames
orderby new FileInfo(fn).CreationTime descending
select fn;

O tipo da váriavel "sort" pode ser um IOrderedEnumerable<string>

Tem uma outra forma com o algoritmo bubble sort, postei na época em ASP e PHP dêem uma olhada.

Tags:   , , ,
Categorias:   Dicas
Ferramentas:   E-mail | del.icio.us | digg | rec6 | linkk | Permalink