.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
Post a Comment