/// <summary> /// Filters FilePathCollection by filenames, in the order specified /// </summary> /// <param name="filePathCollection">the collection to filter</param> /// <param name="fileNames">the file names to filter by</param> /// <returns>the filtered list</returns> public static IEnumerable <FilePath> Filter(this FilePathCollection filePathCollection, params string[] fileNames) { return (fileNames .Select(fileName => filePathCollection.SingleOrDefault(x => x.HasFileName(fileName))) .Where(match => match != null) .ToList()); }