I can't figure it out yet.
void DirSearch(string rootDirectory, string filesExtension, string[] textToSearch, BackgroundWorker worker, DoWorkEventArgs e)
        {
            List<string> resultsoftextfound = new List<string>();
            List<string> filePathList = new List<string>();
            List<string> restrictedFiles = new List<string>();
            int numberoffiles = 0;
            int numberofdirs = 0;
            int countTextToSearch = 0;
            try
            {
                filePathList = SearchAccessibleFilesNoDistinct(rootDirectory, null).ToList();
            }
            catch (Exception err)
            {
                string ad = err.ToString();
            }
            foreach (string file in filePathList)
            {
                try
                {
                    _busy.WaitOne();
                    if (worker.CancellationPending == true)
                    {
                        e.Cancel = true;
                        return;
                    }
                    for (int i = 0; i < textToSearch.Length; i++)
                    {
                        List<MyProgress> prog = new List<MyProgress>();
                        if (File.ReadAllText(file).Contains(textToSearch[i].ToLower()))
                        {
                            resultsoftextfound.Add(file + "  " + textToSearch[i]);
                            numberoffiles++;
                            prog.Add(new MyProgress { Report1 = file, Report2 = numberoffiles.ToString() });
                            backgroundWorker1.ReportProgress(0, prog);
                        }
                    }   
                    numberofdirs++;
                    label1.Invoke((MethodInvoker)delegate
                    {
                        label1.Text = numberofdirs.ToString();
                        label1.Visible = true;
                    });
                }
                catch (Exception)
                {
                    restrictedFiles.Add(file);
                    continue;
                }
            }
        }
In this case i have in textToSearch 6 items:
form1,form2,hi,world,44,44
I found that if the first item in textToSearch is Form1 with large F it will find it but if it's form1 with small f it will not. I tried to add ToLower() like this: if (File.ReadAllText(file).Contains(textToSearch[i].ToLower())) but it didn't help/change much. How can i make that it will consider the same result as form1 or Form1 or FoRM1 ?
 
    