Hello. I have the following task: go through the collection of files, and carry out a filter on certain conditions. Moreover, the conditions are formed immediately before going through all the files. Now it looks like this:
foreach (string f in FileList.MainList) { // max ΡΠ°Π·ΠΌΠ΅Ρ ΠΏΠΎΠ΄Ρ
ΠΎΠ΄ΠΈΡ? if (max_size != 0) continue; // min ΡΠ°Π·ΠΌΠ΅Ρ ΠΏΠΎΠ΄Ρ
ΠΎΠ΄ΠΈΡ? if (min_size != 0) continue ; // ΠΠΌΡ ΡΠ°ΠΉΠ»Π° if (filenameYES!=null || filenameNO!=null) continue; // ΠΠΌΡ ΠΏΠ°ΠΏΠΊΠΈ if (pathnameYES != null || pathnameNO != null) continue; } max_size, min_size, filenameYES, filenameNO and other conditions are determined BEFORE passing through all files. In order to speed up the execution of the code, I somehow need to display a pass through all the files into a separate method, and call this method only with the conditions that are defined. That is, in each file the program did not think what conditions were set, but immediately checked only the specified conditions. Please suggest how to do this.