TreeMachine.Pro 1.2.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package TreeMachine.Pro --version 1.2.0                
NuGet\Install-Package TreeMachine.Pro -Version 1.2.0                
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="1.2.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add TreeMachine.Pro --version 1.2.0                
#r "nuget: TreeMachine.Pro, 1.2.0"                
#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.
// Install TreeMachine.Pro as a Cake Addin
#addin nuget:?package=TreeMachine.Pro&version=1.2.0

// Install TreeMachine.Pro as a Cake Tool
#tool nuget:?package=TreeMachine.Pro&version=1.2.0                

Overview

The library that allows you to easily implement a tree structure.

Reference

namespace System.TreeMachine;
public interface ITree<T> where T : NodeBase<T> {

    protected T? Root { get; set; }

    protected void SetRoot(T? root, object? argument, Action<T>? callback);
    protected void AddRoot(T root, object? argument);
    protected internal void RemoveRoot(T root, object? argument, Action<T>? callback);

}
public abstract partial class NodeBase<TThis> where TThis : NodeBase<TThis> {

    private protected abstract object? Owner { get; set; }
    public abstract ITree<TThis>? Tree { get; }

    public abstract event Action<object?>? OnBeforeAttachEvent;
    public abstract event Action<object?>? OnAfterAttachEvent;
    public abstract event Action<object?>? OnBeforeDetachEvent;
    public abstract event Action<object?>? OnAfterDetachEvent;

    public NodeBase();

    internal abstract void Attach(ITree<TThis> owner, object? argument);
    internal abstract void Detach(ITree<TThis> owner, object? argument);

    internal abstract void Attach(TThis owner, object? argument);
    internal abstract void Detach(TThis owner, object? argument);

    protected abstract void OnAttach(object? argument);
    protected abstract void OnBeforeAttach(object? argument);
    protected abstract void OnAfterAttach(object? argument);

    protected abstract void OnDetach(object? argument);
    protected abstract void OnBeforeDetach(object? argument);
    protected abstract void OnAfterDetach(object? argument);

}
public abstract partial class NodeBase<TThis> {

    [MemberNotNullWhen( false, nameof( Parent ) )] public abstract bool IsRoot { get; }
    public abstract TThis Root { get; }

    public abstract TThis? Parent { get; }
    public abstract IEnumerable<TThis> Ancestors { get; }
    public abstract IEnumerable<TThis> AncestorsAndSelf { get; }

    public abstract IReadOnlyList<TThis> Children { get; }
    public abstract IEnumerable<TThis> Descendants { get; }
    public abstract IEnumerable<TThis> DescendantsAndSelf { get; }

    protected abstract void AddChild(TThis child, object? argument);
    protected abstract void RemoveChild(TThis child, object? argument, Action<TThis>? callback);
    protected abstract bool RemoveChild(Func<TThis, bool> predicate, object? argument, Action<TThis>? callback);
    protected abstract int RemoveChildren(Func<TThis, bool> predicate, object? argument, Action<TThis>? callback);
    protected abstract void RemoveSelf(object? argument, Action<TThis>? callback);

    protected abstract void Sort(List<TThis> children);

}
public abstract partial class NodeBase<TThis> {
    public enum Activity_ {
        Inactive,
        Activating,
        Active,
        Deactivating,
    }

    public abstract Activity_ Activity { get; private protected set; }

    public abstract event Action<object?>? OnBeforeActivateEvent;
    public abstract event Action<object?>? OnAfterActivateEvent;
    public abstract event Action<object?>? OnBeforeDeactivateEvent;
    public abstract event Action<object?>? OnAfterDeactivateEvent;

    private protected abstract void Activate(object? argument);
    private protected abstract void Deactivate(object? argument);

    protected abstract void OnActivate(object? argument);
    protected abstract void OnBeforeActivate(object? argument);
    protected abstract void OnAfterActivate(object? argument);

    protected abstract void OnDeactivate(object? argument);
    protected abstract void OnBeforeDeactivate(object? argument);
    protected abstract void OnAfterDeactivate(object? argument);

}
Product 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. 
.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.

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
1.3.0 125 3/8/2025
1.2.0 194 3/6/2025
1.1.5 104 1/2/2025
1.1.4 90 12/23/2024
1.1.3 102 11/28/2024
1.1.2 95 11/26/2024
1.1.1 97 11/23/2024
1.1.0 98 11/20/2024