.net - Get the latest updated sub-directory -


am trying find latest sub-directory parent director.

public static directoryinfo getlatestsubdirectory(string parentdirpath) 

as of implementation uses bubble sort algorithm find latest comparing creation time.

 if (subdirinfo.creationtimeutc > latestsubdirinfo.creationtimeutc) 

am wondering if there's more efficient way this? linq??

return new directoryinfo(parentdirpath)            .getdirectories()            .orderbydescending(d => d.creationtimeutc)            .first() 

Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -

PostgreSQL 9.x - pg_read_binary_file & inserting files into bytea -