For .Net 3.5.
public IEnumerable<string> GetFiles(
string basePath,
params string[] searchPatterns)
{
if (searchPatterns == null || searchPatterns.Length == 0)
{
return Directory.GetFiles(basePath);
}
return Enumerable.SelectMany(searchPatterns,
p => Directory.GetFiles(basePath, p));
}
Usage:
GetFiles(@"c:\", "*.c", "*.h");
you probably want to add some validation