Filter file lists to get specific type files
c#, windows-store-apps, wpf
Solution
var queryOptions = new QueryOptions(CommonFileQuery.DefaultQuery, new[] { ".mp4" });
queryOptions.FolderDepth = FolderDepth.Deep;
var query = Windows.Storage.KnownFolders.VideosLibrary.CreateFileQueryWithOptions(queryOptions);
var files = await query.GetFilesAsync();
Problem
I got the following code to list files in videos library: ``` var files = await Windows.Storage.KnownFolders.VideosLibrary.GetFilesAsync(); foreach (StorageFile file in files) { textBox1.Text += file.Path + "\n"; } ``` Can I filter the files to get only specific file type files such as mp4 files only? I know I can filter by using "if condition" in the foreach loop - I believe there's better solution and that's why I ask here. Thanks