From 485a6ecabebb05022ca4c3f90f205b085bc5fc1d Mon Sep 17 00:00:00 2001 From: Vitalii Mikhailov Date: Thu, 14 Nov 2024 13:18:22 +0200 Subject: [PATCH] Little linq optimization --- src/Bannerlord.ModuleManager/ModuleUtilities.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Bannerlord.ModuleManager/ModuleUtilities.cs b/src/Bannerlord.ModuleManager/ModuleUtilities.cs index 515b83a..1fb83d6 100644 --- a/src/Bannerlord.ModuleManager/ModuleUtilities.cs +++ b/src/Bannerlord.ModuleManager/ModuleUtilities.cs @@ -144,7 +144,7 @@ public static IEnumerable ValidateModule( { var visited = new HashSet(); return ValidateModuleEx(modules, targetModule, visited, isSelected, - x => ValidateModuleEx(modules, x, isSelected).Count() == 0) + x => !ValidateModuleEx(modules, x, isSelected).Any()) .Select(x => x.ToLegacy()); } @@ -250,7 +250,7 @@ public static IEnumerable ValidateModuleEx( Func isSelected) { var visited = new HashSet(); - foreach (var issue in ValidateModuleEx(modules, targetModule, visited, isSelected, x => ValidateModuleEx(modules, x, isSelected).Count() == 0)) + foreach (var issue in ValidateModuleEx(modules, targetModule, visited, isSelected, x => !ValidateModuleEx(modules, x, isSelected).Any())) { yield return issue; }