Skip to content

Commit 2ab0e8b

Browse files
committed
Returned ReadOnlyTopicCollection
Previously returned the generic interface. Since we know the results will be of type `Topic` (or descendants), it is simpler to return simply `ReadOnlyTopicCollection`. This is also more consistent with .NET Framework Design Guidelines.
1 parent cdaac41 commit 2ab0e8b

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

Ignia.Topics/Collections/RelatedTopicCollection.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ public ReadOnlyCollection<string> Keys {
7171
/// <returns>
7272
/// Returns an enumerable list of <see cref="Topic"/> objects.
7373
/// </returns>
74-
public ReadOnlyTopicCollection<Topic> GetAllTopics() {
75-
Contract.Ensures(Contract.Result<ReadOnlyTopicCollection<Topic>>() != null);
74+
public ReadOnlyTopicCollection GetAllTopics() {
75+
Contract.Ensures(Contract.Result<ReadOnlyTopicCollection>() != null);
7676
var topics = new TopicCollection();
7777
foreach (var topicCollection in this) {
7878
foreach (var topic in topicCollection) {
@@ -81,7 +81,7 @@ public ReadOnlyTopicCollection<Topic> GetAllTopics() {
8181
}
8282
}
8383
}
84-
return new ReadOnlyTopicCollection<Topic>(topics);
84+
return new ReadOnlyTopicCollection(topics);
8585
}
8686

8787
/// <summary>
@@ -90,10 +90,10 @@ public ReadOnlyTopicCollection<Topic> GetAllTopics() {
9090
/// <returns>
9191
/// Returns an enumerable list of <see cref="Topic"/> objects.
9292
/// </returns>
93-
public ReadOnlyTopicCollection<Topic> GetAllTopics(string contentType) {
94-
Contract.Ensures(Contract.Result<ReadOnlyTopicCollection<Topic>>() != null);
93+
public ReadOnlyTopicCollection GetAllTopics(string contentType) {
94+
Contract.Ensures(Contract.Result<ReadOnlyTopicCollection>() != null);
9595
var topics = GetAllTopics().Where(t => t.ContentType == contentType);
96-
return ReadOnlyTopicCollection<Topic>.FromList(topics.ToList());
96+
return ReadOnlyTopicCollection.FromList(topics.ToList());
9797
}
9898

9999
/*==========================================================================================================================

0 commit comments

Comments
 (0)