I would like to convert the below \"foreach\" statement to a LINQ query that returns a substring of the file name into a list:
IList fileNameSu
FYI,
file.Name.Substring(0, file.Name.Length - (file.Name.Length - file.Name.IndexOf(".config.xml")))
is the same as
file.Name.Substring(0, file.Name.IndexOf(".config.xml"));
Also, if that string ".config.xml" appears before the end of the file name, your code will probably return the wrong thing; You should probably change IndexOf to LastIndexOf and check that the index position returned + 11 (the size of the string) == length of the filename (assuming you're looking for files ending in .config.xml and not just files with .config.xml appearing somewhere in the name).