I want to have Excel files whose extensions are xls and xlsx, with FileInfo object from a specific directory so I put the following code
    System.IO.FileInfo[] files = null;
        System.IO.DirectoryInfo dirInfo;
        dirInfo = new System.IO.DirectoryInfo(this.tbFolderTo.Text);
        string[] extensions = new[] { "*.xls", "*.xlsx" };
        List<string> _searchPatternList = new List<string>(extensions);            
        List<string> fileList = new List<string>();
        foreach (string ext in _searchPatternList)
        {
            foreach (string subFile in Directory.GetFiles(this.tbFolderTo.Text, ext))
            {
                fileList.Add(subFile);
            }
        }
        foreach (string file in fileList)
        {
            this.lbFileNamesTo.Items.Add(file);
        }
but the problem by testing with bogus files like filexp2.xlsq or filexp.xlsa , I see these files in my list box to display the list of found files, in code I limited extensions to xls and xlsx I don't know why i see these files in the result
with the result I do not see any difference between the code I puted and this code
        System.IO.FileInfo[] files = null;
        System.IO.DirectoryInfo dirInfo;
        dirInfo = new System.IO.DirectoryInfo(this.tbFolderTo.Text);
        files = dirInfo.GetFiles("*.xls*");
thanks for help