Piotr Czajkowski 5 月之前
父節點
當前提交
e169d3fd19
共有 1 個文件被更改,包括 2 次插入10 次删除
  1. 2 10
      ProcessFiles/ProcessFiles.cs

+ 2 - 10
ProcessFiles/ProcessFiles.cs

@@ -3,6 +3,7 @@ using ProcessFiles.Models;
 using System;
 using System.Collections.Generic;
 using System.IO;
+using System.Linq;
 
 namespace ProcessFiles
 {
@@ -40,16 +41,7 @@ namespace ProcessFiles
         }
 
         private static bool CheckExtension(string extension, string[] validExtensions)
-        {
-            foreach (var validExtension in validExtensions)
-            {
-                if (extension.Equals(validExtension, StringComparison.InvariantCultureIgnoreCase))
-                    return true;
-            }
-
-            return false;
-        }
-
+            => validExtensions.Any(x => x.Equals(extension, StringComparison.InvariantCultureIgnoreCase));
         private bool IsValid(string path, string[] fileExtensions)
         {
             if (!fileSystem.File.Exists(path))