TreeStructures 2.1.0
See the version list below for details.
dotnet add package TreeStructures --version 2.1.0
NuGet\Install-Package TreeStructures -Version 2.1.0
<PackageReference Include="TreeStructures" Version="2.1.0" />
paket add TreeStructures --version 2.1.0
#r "nuget: TreeStructures, 2.1.0"
// Install TreeStructures as a Cake Addin #addin nuget:?package=TreeStructures&version=2.1.0 // Install TreeStructures as a Cake Tool #tool nuget:?package=TreeStructures&version=2.1.0
Introduction
This is a C# library designed to effectively handle tree structures.
The library focuses on flexibility and extensibility, making it easy to manipulate various tree structures.
Key features:
- Rich extension methods for
ITreeNode<TNode>
- Mutual references between parent and child nodes
- A set of classes forming tree structures with extensibility
- Conversion between different data structures and tree structures
- Generic utility classes needed for implementing the above features
Usage
Refer to the wiki
Concept
This library is not intended to be a complete solution on its own.
It aims to provide tree structure functionality while maintaining compatibility with other libraries.
Below is a detailed explanation of the key features.
Rich Extension Methods
Over 60 extension methods are defined for ITreeNode<TNode>
, including overloads.
For example:
Enumeration: Preorder
, Levelorder
, all traversal methods, Leafs
, Ancestors
, DescendArrivals
, DescendTraces
, etc.
Navigation: Root
, NextSibling
, LastSibling
, etc.
Editing: TryAddChild
, Try○○Child
, Disassemble
, RemoveAllDescendant
, etc.
Retrieving parameters: NodeIndex
, NodePath
, Height
, Depth
, etc.
Validation methods: IsDescendantOf
, IsAncestorOf
, IsRoot
, etc.
Conversion: ToNodeMap
, ToSerializableNodeMap
, ToTreeDiagram
, AsValuedTreeNode
Tree construction: Convert
, AssembleTree
, AssembleAsNAryTree
, AssembleForestByPath
Mutual References Between Parent and Child Nodes
Mutual references between parent and child nodes are handled in the base classes (TreeNodeBase
or HierarchyWrapper
).
In TreeNodeBase
derivatives, behavior can be customized by overriding protected virtual
methods such as RemoveChildProcess
and InsertChildProcess
.
A Set of Tree Structure Classes and Their Versatility
Depending on the use case, the following classes can be inherited and used:
- TreeNodeBase: When fine-tuning method definitions is necessary
- GeneralTreeNode / ObservableTreeNode: For use as a data structure or container
- NAryTreeNode: For an N-ary tree where empty nodes are represented as
null
- HierarchyWrapper / TreeNodeWrapper: To wrap hierarchical structures
- BindableHierarchyWrapper / BindableTreeNodeWrapper: For MVVM ViewModels that require observability and disposal
In TreeNodeBase
and its derivatives, the internal collection used and the collection exposed externally can be customized by overriding Setup(Inner | Public)ChildCollection
methods.
For HierarchyWrapper
and its derivatives, only the externally exposed collection can be customized.
Conversion Between Different Data Structures and Tree Structures
Even objects that do not implement ITreeNode<TNode>
can utilize the extension methods for ITreeNode<TNode>
.
By wrapping hierarchical structures using HierarchyWrapper<TSrc,TWrpr>
or BindableHierarchyWrapper<TSrc,TWrpr>
, or calling AsValuedTreeNode
, the extension methods of ITreeNode<TNode>
can be provided.
Additionally, methods such as Convert
, AssembleTree
, and ToNodeMap
enable various conversion options.
Generic Utility Classes Needed for Implementation
Some classes used for internal implementation are also exposed.
ListAligner<T,TList>
Reorders a specified list through manipulation.ImitableCollection<TSrc,TConv>
A collection synchronized with a specified collection.CombinableObservableCollection<T>
A collection that merges multiple observable collections.ReadOnlyObservableItemCollection<T>
An observable collection that links with a specified collection and enables batch property observation of each element.ReadOnlySortFilterObservableCollection<T>
An observable collection that links with a specified collection and adds sorting and filtering functionality.ListScroller<T>
Provides navigation functionality within a collection.UniqueOperationExecutor
Controls operation uniqueness (prevents duplicate execution).PropertyChangeProxy
Assists in implementingINotifyPropertyChanged
.ResultWithValue<TValue>
,ResultWith<TValue>
Manages the result of Try methods.
And more.
Namespaces and Their Classification
Namespaces are categorized by purpose and use case.
Only TreeStructures.Tree
is grouped based on implementation rather than purpose, containing classes that form tree structures according to specific rules.
TreeStructures;
Defines abstract generic tree nodes, related objects, and event arguments.
Inheritance diagram of generic tree nodes:
Inheritance diagram of NodePath and NodeIndex (related objects):
TreeStructures.Linq;
Extension methods for ITreeNode<TNode>
, IMutableTreeNode<TNode>
, and IEnumerable<T>
.
TreeStructures.Collections;
Collections used in internal implementation and extension methods.
TreeStructures.Events;
Event-related classes that support listener and notification implementation.
TreeStructures.Results;
Defines ResultWithValue<T>
used as the return value for Try○○ methods.
TreeStructures.Utilities;
General-purpose classes that do not fit into the above categories.
TreeStructures.Xml.Serialization;
Dictionaries and other structures used for serialization and deserialization.
TreeStructures.Internals;
Classes used internally in the library but with limited general applicability.
TreeStructures.Tree;
Classes that form tree structures based on specific purposes and use cases.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 is compatible. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Microsoft.Bcl.HashCode (>= 6.0.0)
-
.NETStandard 2.1
- No dependencies.
-
net6.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
2.1.1 | 49 | 3/29/2025 |
2.1.0 | 84 | 3/28/2025 |
2.0.1 | 245 | 3/23/2025 |
2.0.0 | 240 | 3/23/2025 |
1.9.4 | 134 | 3/23/2025 |
1.9.2 | 136 | 3/15/2025 |
1.9.1 | 158 | 3/11/2025 |
1.9.0 | 156 | 3/10/2025 |
1.8.0 | 112 | 12/17/2024 |
1.7.8 | 101 | 11/24/2024 |
1.7.7 | 87 | 11/24/2024 |
1.7.6 | 90 | 11/23/2024 |
1.7.5 | 99 | 11/22/2024 |
1.7.4 | 166 | 1/31/2024 |
1.7.3 | 116 | 1/31/2024 |
1.7.2 | 114 | 1/31/2024 |
1.7.1 | 116 | 1/31/2024 |
1.7.0 | 98 | 1/30/2024 |
1.6.3 | 120 | 1/21/2024 |
1.6.2 | 112 | 1/21/2024 |
1.6.1 | 117 | 1/21/2024 |
1.6.0 | 112 | 1/21/2024 |
1.5.0 | 115 | 1/18/2024 |
1.4.6 | 130 | 1/14/2024 |
1.4.5 | 118 | 1/14/2024 |
1.4.4 | 118 | 1/10/2024 |
1.4.3 | 111 | 1/10/2024 |
1.4.1 | 114 | 1/8/2024 |
1.4.0 | 106 | 1/6/2024 |
1.3.1 | 99 | 1/3/2024 |
1.3.0 | 123 | 1/2/2024 |
1.2.0 | 161 | 12/30/2023 |
1.1.1 | 120 | 12/26/2023 |
1.1.0 | 139 | 12/21/2023 |
1.0.1 | 142 | 12/16/2023 |
1.0.0 | 143 | 12/14/2023 |