Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

How to get the newest FileSystemInfo item on a directory?

$
0
0

I need to know the newest file in the entire folder and i am doing this

IList<FileSystemInfo> visibleThings = new List<FileSystemInfo>();
var dir = new DirectoryInfo(directory);
try
{
foreach (var item in dir.GetFileSystemInfos().Where(item => item.IsVisible()))
{
if(item.Extension == ".zip" ||item.Extension == null ||item.Extension == ""){
visibleThings.Add(item);
}
}
}

Maybe should i create a list and fill it with my item.CreationTime or something?


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>