IReadOnlyTopicCollection.TryFindBySubpath Method

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

Definition

Attempts to find a file-backed topic in the topic hierarchy by its subpaths.
bool TryFindBySubpath(string filePath, [NotNullWhen(true)] out TopicModel topic)

Parameters

filePath string
The file path or subpath of the topic to lookup.
topic TopicModel
When this method returns, contains the topic that uniquely matches the specified file path or subpath; otherwise, null if no match or if ambiguous.

Returns

bool
true if a unique matching topic was found; otherwise, false.

Remarks

This method searches for a file-backed topic whose file path is equal to or is a more specific path than the provided filePath. If multiple topics match, the match is considered ambiguous and the method returns false.

Matching is case-insensitive and directory separators can be either slash ('/') or backslash ('\'). The search is performed in linear time O(n) relative to the number of file-backed topics.

See Also