From 3e5b969d09158a241f684887c1e9752910ac915e Mon Sep 17 00:00:00 2001 From: Andreas Weizel Date: Sat, 28 Jun 2014 17:04:00 +0200 Subject: [PATCH] Reduced unneeded lookup iterations when several symbol searches have the same search term. --- .../CSharpBinding/Project/Src/Parser/CSharpSymbolSearch.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Parser/CSharpSymbolSearch.cs b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Parser/CSharpSymbolSearch.cs index df942efb17..fbd05adfc5 100644 --- a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Parser/CSharpSymbolSearch.cs +++ b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Parser/CSharpSymbolSearch.cs @@ -131,7 +131,7 @@ namespace CSharpBinding if (textSource == null) return; if (searchScopeList != null) { - if (!searchScopeList.Any( + if (!searchScopeList.DistinctBy(scope => scope.SearchTerm ?? String.Empty).Any( scope => (scope.SearchTerm == null) || (textSource.IndexOf(scope.SearchTerm, 0, textSource.TextLength, StringComparison.Ordinal) >= 0))) return; } @@ -216,7 +216,7 @@ namespace CSharpBinding if (textSource == null) return; if (searchScopeList != null) { - if (!searchScopeList.Any( + if (!searchScopeList.DistinctBy(scope => scope.SearchTerm ?? String.Empty).Any( scope => (scope.SearchTerm == null) || (textSource.IndexOf(scope.SearchTerm, 0, textSource.TextLength, StringComparison.Ordinal) >= 0))) return; }