You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

TreeSharp.ex

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

TreeSharp.ex

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.

1.0.3
Source
nugetNuGet
Version published
Maintainers
1
Created
Source

TreeSharp.ex

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

Features

  • 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

Installation

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

Usage

  • Import the TreeSharp namespace in your C# project:

    using TreeSharp.ex;

  • 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);

  • 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);

  • 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);

  • 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.

Contributing

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

License

TreeSharp is Free Forever

Keywords

tree

FAQs

Package last updated on 09 Mar 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.