Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Multiple search patterns with DirectoryInfo.GetFiles()
namespace Diuturnal.Utility {
public class DirectoryHelper {
public static FileInfo[] GetFiles(DirectoryInfo directory,
params string[] searchPatterns) {
List<FileInfo> allFiles = new List<FileInfo>();
foreach (string pattern in searchPatterns) {
allFiles.Sort(delegate(FileInfo x, FileInfo y)
{ return x.Name.CompareTo(y.Name); });
return allFiles.ToArray();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.