What is the syntax for setting multiple file-extensions as searchPattern
on Directory.GetFiles()
? For example filtering out files with .aspx and .ascx extensions.
// TODO: Set the string 'searchPattern' to only get files with
// the extension '.aspx' and '.ascx'.
var filteredFiles = Directory.GetFiles(path, searchPattern);
Update: LINQ is not an option, it has to be a searchPattern
passed into GetFiles
, as specified in the question.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…