I am trying to use the Directory.GetFiles() method to retrieve a list of files of multiple types, such as mp3\'s and jpg\'s. I have t
Directory.GetFiles()
mp3
jpg
Here is a simple and elegant way of getting filtered files
var allowedFileExtensions = ".csv,.txt"; var files = Directory.EnumerateFiles(@"C:\MyFolder", "*.*", SearchOption.TopDirectoryOnly) .Where(s => allowedFileExtensions.IndexOf(Path.GetExtension(s)) > -1).ToArray();