c# - Sorting Files by date -


i using such code compare files sort date..

fileinfo f = new fileinfo(name1); fileinfo f1 = new fileinfo(name2); if (f.exists && f1.exists)    output = datetime.compare(f.lastwritetime, f1.lastwritetime); 

is there better , faster way sort date?

at time can compare 2 items...

i not sort getting files directory.

you can use linq:

var sortedfiles = new directoryinfo(@"d:\samples").getfiles()                                                   .orderby(f => f.lastwritetime)                                                   .tolist(); 

Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -