From 1d83bdd97cbe169ac50536bda5db9f67240f7935 Mon Sep 17 00:00:00 2001 From: Stefan Bodewig Date: Thu, 16 Dec 2021 18:40:44 +0100 Subject: [PATCH] can avoid craetion of temporary list --- src/main/net-core/Diff/DOMDifferenceEngine.cs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/main/net-core/Diff/DOMDifferenceEngine.cs b/src/main/net-core/Diff/DOMDifferenceEngine.cs index 6a1d90a..0931efb 100644 --- a/src/main/net-core/Diff/DOMDifferenceEngine.cs +++ b/src/main/net-core/Diff/DOMDifferenceEngine.cs @@ -468,13 +468,11 @@ private ComparisonState CompareNodeLists(IEnumerable allControlChildren IEnumerable> matches = NodeMatcher.Match(controlSeq, testSeq); - IList controlListForXpath = new List(allControlChildren); - IList testListForXpath = new List(allTestChildren); IList controlList = new List(controlSeq); IList testList = new List(testSeq); - IDictionary controlListForXpathIndex = Index(controlListForXpath); - IDictionary testListForXpathIndex = Index(testListForXpath); + IDictionary controlListForXpathIndex = Index(allControlChildren); + IDictionary testListForXpathIndex = Index(allTestChildren); IDictionary controlListIndex = Index(controlList); IDictionary testListIndex = Index(testList); @@ -743,7 +741,7 @@ private static XmlAttribute FindMatchingAttr(IList attrs, return null; } - private static IDictionary Index(IList nodes) { + private static IDictionary Index(IEnumerable nodes) { IDictionary indices = new Dictionary(); int idx = 0; foreach (XmlNode n in nodes) {