TreeMachine.Pro
3.0.1
dotnet add package TreeMachine.Pro --version 3.0.1
NuGet\Install-Package TreeMachine.Pro -Version 3.0.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="TreeMachine.Pro" Version="3.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="TreeMachine.Pro" Version="3.0.1" />
<PackageReference Include="TreeMachine.Pro" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add TreeMachine.Pro --version 3.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: TreeMachine.Pro, 3.0.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package TreeMachine.Pro@3.0.1
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=TreeMachine.Pro&version=3.0.1
#tool nuget:?package=TreeMachine.Pro&version=3.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Overview
The library that allows you to easily implement a hierarchical object.
Reference
System.TreeMachine.Pro
namespace System.TreeMachine.Pro;
public abstract class TreeMachineBase {
}
public abstract class TreeMachineBase<T> : TreeMachineBase where T : notnull, NodeBase<T> {
protected T? Root { get; }
public TreeMachineBase();
protected virtual void AddRoot(T root, object? argument);
protected virtual void RemoveRoot(T root, object? argument, Action<T, object?>? callback);
protected void RemoveRoot(object? argument, Action<T, object?>? callback);
}
public enum Activity {
Inactive,
Activating,
Active,
Deactivating,
}
// NodeBase
public abstract partial class NodeBase<TThis> where TThis : notnull, NodeBase<TThis> {
public TreeMachineBase<TThis>? Machine { get; }
[MemberNotNullWhen( false, nameof( Parent ) )] public bool IsRoot { get; }
public TThis Root { get; }
public TThis? Parent { get; }
public IEnumerable<TThis> Ancestors { get; }
public IEnumerable<TThis> AncestorsAndSelf { get; }
public Activity Activity { get; }
public IReadOnlyList<TThis> Children { get; }
public IEnumerable<TThis> Descendants { get; }
public IEnumerable<TThis> DescendantsAndSelf { get; }
public NodeBase();
}
public abstract partial class NodeBase<TThis> {
protected abstract void OnAttach(object? argument);
protected virtual void OnBeforeAttach(object? argument);
protected virtual void OnAfterAttach(object? argument);
protected abstract void OnDetach(object? argument);
protected virtual void OnBeforeDetach(object? argument);
protected virtual void OnAfterDetach(object? argument);
}
public abstract partial class NodeBase<TThis> {
protected abstract void OnActivate(object? argument);
protected virtual void OnBeforeActivate(object? argument);
protected virtual void OnAfterActivate(object? argument);
protected abstract void OnDeactivate(object? argument);
protected virtual void OnBeforeDeactivate(object? argument);
protected virtual void OnAfterDeactivate(object? argument);
}
public abstract partial class NodeBase<TThis> {
protected virtual void AddChild(TThis child, object? argument);
protected void AddChildren(IEnumerable<TThis> children, object? argument);
protected virtual void RemoveChild(TThis child, object? argument, Action<TThis, object?>? callback);
protected bool RemoveChild(Func<TThis, bool> predicate, object? argument, Action<TThis, object?>? callback);
protected int RemoveChildren(Func<TThis, bool> predicate, object? argument, Action<TThis, object?>? callback);
protected int RemoveChildren(object? argument, Action<TThis, object?>? callback);
protected void RemoveSelf(object? argument, Action<TThis, object?>? callback);
protected virtual void Sort(List<TThis> children);
}
// NodeBase2
public abstract partial class NodeBase2<TThis> : NodeBase<TThis> where TThis : notnull, NodeBase2<TThis> {
protected override void OnBeforeAttach(object? argument);
protected override void OnAfterAttach(object? argument);
protected override void OnBeforeDetach(object? argument);
protected override void OnAfterDetach(object? argument);
protected abstract void OnBeforeDescendantAttach(TThis descendant, object? argument);
protected abstract void OnAfterDescendantAttach(TThis descendant, object? argument);
protected abstract void OnBeforeDescendantDetach(TThis descendant, object? argument);
protected abstract void OnAfterDescendantDetach(TThis descendant, object? argument);
}
public abstract partial class NodeBase2<TThis> {
protected override void OnBeforeActivate(object? argument);
protected override void OnAfterActivate(object? argument);
protected override void OnBeforeDeactivate(object? argument);
protected override void OnAfterDeactivate(object? argument);
protected abstract void OnBeforeDescendantActivate(TThis descendant, object? argument);
protected abstract void OnAfterDescendantActivate(TThis descendant, object? argument);
protected abstract void OnBeforeDescendantDeactivate(TThis descendant, object? argument);
protected abstract void OnAfterDescendantDeactivate(TThis descendant, object? argument);
}
namespace System.TreeMachine.Pro;
public sealed class TreeMachine<T, TUserData> : TreeMachineBase<T> where T : notnull, NodeBase<T> {
public new T? Root { get; }
public TUserData UserData { get; }
public TreeMachine(TUserData userData);
public new void AddRoot(T root, object? argument);
public new void RemoveRoot(T root, object? argument, Action<T, object?>? callback);
public new void RemoveRoot(object? argument, Action<T, object?>? callback);
}
// Node
public sealed class Node<TUserData> : NodeBase<Node<TUserData>> {
public TUserData UserData { get; }
public Action<List<Node<TUserData>>>? SortDelegate { get; init; }
public event Action<object?>? OnAttachCallback;
public event Action<object?>? OnDetachCallback;
public event Action<object?>? OnActivateCallback;
public event Action<object?>? OnDeactivateCallback;
public Node(TUserData userData);
protected override void OnAttach(object? argument);
protected override void OnDetach(object? argument);
protected override void OnActivate(object? argument);
protected override void OnDeactivate(object? argument);
public new void AddChild(Node<TUserData> child, object? argument);
public new void AddChildren(IEnumerable<Node<TUserData>> children, object? argument);
public new void RemoveChild(Node<TUserData> child, object? argument, Action<Node<TUserData>, object?>? callback);
public new bool RemoveChild(Func<Node<TUserData>, bool> predicate, object? argument, Action<Node<TUserData>, object?>? callback);
public new int RemoveChildren(Func<Node<TUserData>, bool> predicate, object? argument, Action<Node<TUserData>, object?>? callback);
public new int RemoveChildren(object? argument, Action<Node<TUserData>, object?>? callback);
public new void RemoveSelf(object? argument, Action<Node<TUserData>, object?>? callback);
protected override void Sort(List<Node<TUserData>> children);
}
// Node2
public sealed class Node2<TUserData> : NodeBase2<Node2<TUserData>> {
public TUserData UserData { get; }
public Action<List<Node2<TUserData>>>? SortDelegate { get; init; }
public event Action<object?>? OnAttachCallback;
public event Action<object?>? OnDetachCallback;
public event Action<object?>? OnActivateCallback;
public event Action<object?>? OnDeactivateCallback;
public event Action<Node2<TUserData>, object?>? OnBeforeDescendantAttachCallback;
public event Action<Node2<TUserData>, object?>? OnAfterDescendantAttachCallback;
public event Action<Node2<TUserData>, object?>? OnBeforeDescendantDetachCallback;
public event Action<Node2<TUserData>, object?>? OnAfterDescendantDetachCallback;
public event Action<Node2<TUserData>, object?>? OnBeforeDescendantActivateCallback;
public event Action<Node2<TUserData>, object?>? OnAfterDescendantActivateCallback;
public event Action<Node2<TUserData>, object?>? OnBeforeDescendantDeactivateCallback;
public event Action<Node2<TUserData>, object?>? OnAfterDescendantDeactivateCallback;
public Node2(TUserData userData);
protected override void OnAttach(object? argument);
protected override void OnDetach(object? argument);
protected override void OnActivate(object? argument);
protected override void OnDeactivate(object? argument);
protected override void OnBeforeDescendantAttach(Node2<TUserData> descendant, object? argument);
protected override void OnAfterDescendantAttach(Node2<TUserData> descendant, object? argument);
protected override void OnBeforeDescendantDetach(Node2<TUserData> descendant, object? argument);
protected override void OnAfterDescendantDetach(Node2<TUserData> descendant, object? argument);
protected override void OnBeforeDescendantActivate(Node2<TUserData> descendant, object? argument);
protected override void OnAfterDescendantActivate(Node2<TUserData> descendant, object? argument);
protected override void OnBeforeDescendantDeactivate(Node2<TUserData> descendant, object? argument);
protected override void OnAfterDescendantDeactivate(Node2<TUserData> descendant, object? argument);
public new void AddChild(Node2<TUserData> child, object? argument);
public new void AddChildren(IEnumerable<Node2<TUserData>> children, object? argument);
public new void RemoveChild(Node2<TUserData> child, object? argument, Action<Node2<TUserData>, object?>? callback);
public new bool RemoveChild(Func<Node2<TUserData>, bool> predicate, object? argument, Action<Node2<TUserData>, object?>? callback);
public new int RemoveChildren(Func<Node2<TUserData>, bool> predicate, object? argument, Action<Node2<TUserData>, object?>? callback);
public new int RemoveChildren(object? argument, Action<Node2<TUserData>, object?>? callback);
public new void RemoveSelf(object? argument, Action<Node2<TUserData>, object?>? callback);
protected override void Sort(List<Node2<TUserData>> children);
}
Link
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. 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. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
.NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.1 is compatible. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.1
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on TreeMachine.Pro:
Package | Downloads |
---|---|
GameFramework.Pro
The framework that allows you to design high-quality architecture of your game project. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last Updated |
---|---|---|
3.0.1 | 88 | 9/6/2025 |