How to get multiple files with different extension?

You can't set more search filters, because GetFiles only accepts a single search pattern. Instead, you can call GetFiles with no pattern, and filter the results in code, using Lambda expressions:

using System.Linq;

   public YourMethodToStart()
      FileInfo[] fiels = GetFilesFromFolder(@"C:\1");

    private FileInfo[] GetFilesFromFolder(string path)
      string[] extensions = new[] { ".txt", ".zip", ".exe" };
      DirectoryInfo dInfo = new DirectoryInfo(path);

      FileInfo[] files = dInfo.GetFiles()
        .Where(f => extensions.Contains(f.Extension.ToLower()))
      return files;

ref :

+ Recent posts