TreeSharp.ex 1.0.3

dotnet add package TreeSharp.ex --version 1.0.3                
NuGet\Install-Package TreeSharp.ex -Version 1.0.3                
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="TreeSharp.ex" Version="1.0.3" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add TreeSharp.ex --version 1.0.3                
#r "nuget: TreeSharp.ex, 1.0.3"                
#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 TreeSharp.ex as a Cake Addin
#addin nuget:?package=TreeSharp.ex&version=1.0.3

// Install TreeSharp.ex as a Cake Tool
#tool nuget:?package=TreeSharp.ex&version=1.0.3                


TreeSharp is a C# class library that simplifies working with tree structures in your code. With TreeSharp, you can easily build a list of items as a tree, and retrieve all children, parents, and leaves of a specific item within that tree.

NuGet | V1.0.3

Kindly to check all change history in Github repository commits


  • GetTree : builds a tree from a list of items
  • GetChildren : retrieves all children of a specific item in the tree
  • GetParents : retrieves all parents of a specific item in the tree
  • GetLeaves : retrieves all leaves (nodes with no children) of the tree


  1. You can install TreeSharp via NuGet package manager. Simply search for "TreeSharp.ex" and click "Install".
  2. You can install TreeSharp via command in the Package Manager Console: Install-Package TreeSharp.ex


  1. Import the TreeSharp namespace in your C# project:

    using TreeSharp.ex;

  2. To build a tree from a list of items, use the GetTree extension method:

    var tree = items.GetTree(selector: item => item.Id, parent_selector: item => item.ParentId);

  3. To retrieve all children of a specific item, use the GetChildren extension method:

    var children = item.GetChildren(selector: node => node.Id, parent_selector: node => node.ParentId);

  4. To retrieve all parents of a specific item, use the GetParents extension method:

    var parents = item.GetParents(selector: node => node.Id, parent_selector: node => node.ParentId);

  5. To retrieve all leaves of the tree, use the GetLeaves extension method:

    var leaves = tree.GetLeaves(selector: node => node.Id, parent_selector: node => node.ParentId);

Required Parameters:

  • selector : represents the unique identifier of the node.
  • parent_selector : represents the identifier of the parent node.

Optional Parameters:

  • start: Represents the root node (could be null) or a node to start from.
  • include_start_node: Flag to determine whether to include the start value with the result or not.
  • depth: The depth level of building the tree or retrieving parents/children.


Contributions are always welcome! If you find a bug or have a feature request, please open an issue. Pull requests are also accepted.


TreeSharp is Free Forever

Product Compatible and additional computed target framework versions.
.NET 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • 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
1.0.3 346 3/9/2023
1.0.2 241 3/9/2023
1.0.1 261 2/24/2023
1.0.0 250 2/24/2023