Skip to content

Commit 75f6369

Browse files
committed
Fixed Topic.FindAll() extension method to use Collection<Topic>
Previously, the `Topic.FindAll()` method was using a `KeyedTopicCollection`, which prevented duplicate keys. We had migrated `Topic.FindAll()` to an `IEnumerable<Topic>` in order to allow duplicates. This remedies that conflict.
1 parent 99e84ca commit 75f6369

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

OnTopic/Querying/TopicExtensions.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
\=============================================================================================================================*/
66
using System;
77
using System.Collections.Generic;
8+
using System.Collections.ObjectModel;
89
using OnTopic.Attributes;
910
using OnTopic.Collections;
1011
using OnTopic.Internal.Diagnostics;
@@ -129,7 +130,7 @@ public static IEnumerable<Topic> FindAll(this Topic topic, Func<Topic, bool> pre
129130
/*------------------------------------------------------------------------------------------------------------------------
130131
| Search attributes
131132
\-----------------------------------------------------------------------------------------------------------------------*/
132-
var results = new KeyedTopicCollection();
133+
var results = new Collection<Topic>();
133134

134135
if (predicate(topic)) {
135136
results.Add(topic);
@@ -141,7 +142,7 @@ public static IEnumerable<Topic> FindAll(this Topic topic, Func<Topic, bool> pre
141142
foreach (var child in topic.Children) {
142143
var nestedResults = child.FindAll(predicate);
143144
foreach (var matchedTopic in nestedResults) {
144-
if (!results.Contains(matchedTopic.Key)) {
145+
if (!results.Contains(matchedTopic)) {
145146
results.Add(matchedTopic);
146147
}
147148
}

0 commit comments

Comments
 (0)