diff --git a/Swordfish.NET.CollectionsV3/ImmutableDictionaryListPair.cs b/Swordfish.NET.CollectionsV3/ImmutableDictionaryListPair.cs index c0e7f3b..b56e4f5 100644 --- a/Swordfish.NET.CollectionsV3/ImmutableDictionaryListPair.cs +++ b/Swordfish.NET.CollectionsV3/ImmutableDictionaryListPair.cs @@ -61,7 +61,8 @@ public ImmutableDictionaryListPair AddRange(IEnumerable new ObservableDictionaryNode(firstItem, endNode), - (previousNode, pair) => new ObservableDictionaryNode(pair, previousNode)); + (previousNode, pair) => new ObservableDictionaryNode(pair, previousNode)) + .ToList(); // create the key/value pairs for the internal dictionary var dictionaryEntries = nodes.Select(node => KeyValuePair.Create(node.Key, node)); @@ -151,7 +152,9 @@ public ImmutableDictionaryListPair RemoveRange(IList keys) var nodesToRemove = keys.Where(key => Dictionary.ContainsKey(key)).Select(key => Dictionary[key]); if (nodesToRemove.Any()) { - return new ImmutableDictionaryListPair(Dictionary.RemoveRange(keys), List.RemoveRange(nodesToRemove)); + var newDictionary = Dictionary.RemoveRange(keys); + var newList = List.RemoveRange(nodesToRemove); + return new ImmutableDictionaryListPair(newDictionary, newList); } else