The OrFilter class serves the same purpose as a logical-or operator. It states the items must match at least one of the filters it regroups in order to be processed.
Demonstrations
This example processes all the files that have the TXT or the EXE extension.
VB.NET | ![]() |
---|---|
|
C# | ![]() |
---|---|
|
Since using a pipe (|) in the constructor of a NameFilter class accomplishes the same thing as regrouping multiple NameFilter classes within an OrFilter class, the following code would be simpler.
VB.NET | ![]() |
---|---|
Dim files As AbstractFile() = myFolder.GetFiles( "*.txt|*.exe" ) |
C# | ![]() |
---|---|
AbstractFile[] files = myFolder.GetFiles( "*.txt|*.exe" ); |
This example processes all the files that have the TXT extension or are greater than 10k in size. Again, we omit the creation of the NameFilter class around the name mask since it is already being created underneath.
VB.NET | ![]() |
---|---|
|
C# | ![]() |
---|---|
|