I am using the statement
DirectoryInfo.EnumerateFiles(filter) where filter is a string. I want to set filter to be able to search for 2 different strings. How can I do that?
If I search for one string then:
filter = "CM_*";
But I want to search for 2 different strings.
Should I use:
filter = "CM_*, CDH_*";
I search online and cannot find the answer or if I can do this. Filter is a parameter coming in and it all has to be in one field. I thought I had figured it out but I cannot remember what I did.
Thanks,
arep
DirectoryInfo.EnumerateFiles(filter)
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.

VulpesRank #55 · 29.2K reputationPosted Jul 11, 2012, 3:17 PM EDT
http://msdn.microsoft.com/en-us/library/8he88b63.aspx
What I'd suggest you do is to split the incoming filter into two using the comma as separator. You then need to apply the two filters separately and (if necessary) amalgamate the resulting FileInfo arrays into a single array.
A RepaskyRank #8,108 · 228 reputationPosted Jul 12, 2012, 9:57 AM EDT
arep
repasky3 reputationPosted Jul 14, 2012, 4:12 PM EDT
arep