Q:

When changing file names in an array ToLower(), do I need to repopulate the array after changing file names to lower?

if (fbFolderBrowser.ShowDialog() == DialogResult.OK)
            {
                LastSelectedFolder = fbFolderBrowser.SelectedPath;

                originalFiles = Directory.GetFiles(fbFolderBrowser.SelectedPath).Where(file => !file.EndsWith(".db")).ToArray();

                //lower casing the extensions here.
                foreach (string file in originalFiles)
                {
                    File.Move(file, Path.ChangeExtension(file, Path.GetExtension(file).ToLower()));
                }

                //after im done changing the files to lower case, do I need to repopulate the array with the lowered case file names?
                originalFiles = Directory.GetFiles(fbFolderBrowser.SelectedPath).Where(file => !file.EndsWith(".db")).ToArray();
            }

After I go through each file in a folder and make sure the extension is lower case, do I need to repopulate the array (in this case originalFiles) with the lowered case names like I'm doing above?

A:

Use the appropriate overload of EndsWith and you can stop caring about case.
// for example
file.EndsWith(".db", StringComparison.OrdinalIgnoreCase)

