.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

silverlight - Applying a style to ItemContainerStyle in C# -

c# - NullReferenceException in MySqlClient.NativeDriver -

php - How can I merge Nodes & Webform Submissions into instances of one general Content Type in Drupal 6? -