dc

dc

  • NA
  • 663
  • 0

C# using linq statement

May 7 2013 2:40 PM
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)