Maybe
int count = ImgDirInfo.EnumerateFiles("*.jpg").Count(f => f.Name.Length == 26);
EnumerateFiles
is more efficient since it doesn't need to load all files into memory before it starts processing.
- When you use EnumerateFiles, you can start enumerating the collection of FileInfo objects before the whole collection is returned.
- When you use GetFiles, you must wait for the whole array of FileInfo objects to be returned before you can access the array.