-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathTopicCollection.cs
More file actions
61 lines (54 loc) · 3.14 KB
/
TopicCollection.cs
File metadata and controls
61 lines (54 loc) · 3.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/*==============================================================================================================================
| Author Ignia, LLC
| Client Ignia, LLC
| Project Topics Library
\=============================================================================================================================*/
using System.Collections.ObjectModel;
namespace OnTopic.Collections {
/*============================================================================================================================
| CLASS: TOPIC COLLECTION
\---------------------------------------------------------------------------------------------------------------------------*/
/// <summary>
/// Represents a collection of <see cref="Topic"/> objects.
/// </summary>
public class TopicCollection : Collection<Topic> {
/*==========================================================================================================================
| CONSTRUCTOR
\-------------------------------------------------------------------------------------------------------------------------*/
/// <summary>
/// Initializes a new instance of the <see cref="TopicCollection"/>.
/// </summary>
/// <param name="topics">Seeds the collection with an optional list of topic references.</param>
[ExcludeFromCodeCoverage]
public TopicCollection(IEnumerable<Topic>? topics = null) : base(topics?.ToList()?? new()) {
}
/*==========================================================================================================================
| METHOD: AS READ ONLY
\-------------------------------------------------------------------------------------------------------------------------*/
/// <summary>
/// Retrieves a read-only version of this <see cref="TopicCollection"/>.
/// </summary>
public ReadOnlyTopicCollection AsReadOnly() => new(this);
/*==========================================================================================================================
| METHOD: GET VALUE
\-------------------------------------------------------------------------------------------------------------------------*/
/// <inheritdoc cref="KeyedTopicCollection{T}.GetTopic(String)"/>
[ExcludeFromCodeCoverage]
[Obsolete(
$"The {nameof(GetValue)} method is not implemented on {nameof(TopicCollection)}. Use {nameof(KeyedTopicCollection)} " +
$"instead.",
true
)]
public Topic? GetValue(string key) => throw new NotImplementedException();
/*==========================================================================================================================
| INDEXER
\-------------------------------------------------------------------------------------------------------------------------*/
/// <inheritdoc cref="KeyedTopicCollection{T}"/>
[ExcludeFromCodeCoverage]
[Obsolete(
$"Indexing by key is not implemented on the {nameof(TopicCollection)}. Use the {nameof(KeyedTopicCollection)} instead.",
true
)]
public Topic this[string key] => throw new ArgumentOutOfRangeException(nameof(key));
} //Class
} //Namespace