4
Answers

C# using linq statement

dc

dc

11y
1.5k
1
For code that is wruitten as C# 2008 desktop/windows form application, I have the following code that exists:
string[] excelFiles = Directory.GetFiles(strStartPath, "*ErrorReport*.xlsx")
        .Select(path => Path.GetFileName(path))
        .Where(x => !x.StartsWith("~")) //prevents files in alternate location from being selected
        .ToArray();

I want to be able to look for files that say either "*ErrorReport*.xlsx" or ""*CustomerReport*.xlsx". However i
can not get this code to take any kind of a 'or' statement I give to.

Thus can you show me how to change the code so that it will look for either ErrorReport or CustomerReport?
Answers (4)