TopicCollection Class

Namespace
Kampute.DocToolkit.Collections
Assembly
  • Kampute.DocToolkit.dll

Definition

Represents a collection of top-level topics in a documentation context.
public class TopicCollection : IReadOnlyTopicCollection
Inheritance
Implements

Remarks

The TopicCollection class provides functionality for managing top-level topics in a documentation context. It maintains topics in an efficient dictionary structure with case-insensitive keys, enabling fast lookups for a topic in the topic hierarchy by its qualified identifier or URI reference.

Thread Safety

Public static members of the type are guaranteed to be thread-safe. However, public instance members are not thread-safe.

Constructors

TopicCollection(IDocumentationContext)Initializes a new instance of the TopicCollection class.
TopicCollection(IDocumentationContext, Func<IDocumentationContext, ITopic, TopicModel>)Initializes a new instance of the TopicCollection class with a custom topic factory.
TopicCollection(IDocumentationContext, IEnumerable<ITopic>)Initializes a new instance of the TopicCollection class with initial topics.
TopicCollection(IDocumentationContext, Func<IDocumentationContext, ITopic, TopicModel>, IEnumerable<ITopic>)Initializes a new instance of the TopicCollection class with a custom topic factory and initial topics.

Properties

ContextGets the documentation context associated with this collection of topics.
CountGets the number of top-level topics in the collection.
FlattenGets all topics in the collection, including all nested topics.

Methods

Add(ITopic)Adds a top-level topic and all its subtopics to the collection.
Clear()Removes all topics from the collection.
GetEnumerator()Returns an enumerator that iterates through the collection.
Remove(TopicModel)Removes a top-level topic and all its subtopics from the collection.
TryFindBySubpath(string, out TopicModel)Attempts to find a file-backed topic in the topic hierarchy by its subpaths.
TryGetByFilePath(string, out TopicModel)Attempts to lookup a file-backed topic in the topic hierarchy by its full path.
TryGetById(string, out TopicModel)Attempts to find a topic in the topic hierarchy by its qualified identifier.
TryResolve(string, out TopicModel)Attempts to resolve a topic in the collection based on the provided reference string.

Explicit Interface Implementations

IEnumerable.GetEnumerator()Returns an enumerator that iterates through the collection.