I'm looking for a way to improve my File Search.
Currently i'm working with this Method:
public IEnumerable<FileInfo> FindFilesInDirectory(string dirPath, string searchName)
{
return Directory.Exists(dirPath)
? Directory.GetFiles(dirPath, "*.*", SearchOption.AllDirectories)
.ToList()
.ConvertAll(x => new FileInfo(x))
.Where(x => x.Name.ToLower().Contains(searchName.ToLower()))
: null;
}
Is there any faster or better way to do this?
Thanks