# Tree<T> class

Namespace: [Grasshopper2.Data](https://developer.rhino3d.com/api/gh2/namespace/grasshopper2.data.md) · Assembly: [Grasshopper2](https://developer.rhino3d.com/api/gh2/assembly/grasshopper2.md)

```cs
[DebuggerDisplay("{DebuggerDisplay}")]
public abstract class Tree<T> : ITree
```

Strongly typed version of the ITree interface.

**Type parameters:**

- `T`: Type constraint.

## Properties

- [AllItems](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.tree-1/allitems.md): Enumerate over all items in this tree.
- [AllPears](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.tree-1/allpears.md): Enumerate over all item/meta data pears in this tree.
- [AllTwigs](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.tree-1/alltwigs.md): Enumerate over all twigs in this tree.
- [CommonMetaData](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.tree-1/commonmetadata.md): Gets the non-conflicting meta data inside this tree.
- [DebuggerDisplay](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.tree-1/debuggerdisplay.md)
- [Description](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.tree-1/description.md): Gets a string describing the topology of this tree.
- [ITree.AllItems](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.tree-1/grasshopper2-data-itree-allitems.md)
- [ITree.AllPears](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.tree-1/grasshopper2-data-itree-allpears.md)
- [ITree.AllTwigs](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.tree-1/grasshopper2-data-itree-alltwigs.md)
- [ITree.Items](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.tree-1/grasshopper2-data-itree-items.md)
- [ITree.NonNullItems](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.tree-1/grasshopper2-data-itree-nonnullitems.md)
- [ITree.NonNullPears](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.tree-1/grasshopper2-data-itree-nonnullpears.md)
- [ITree.Pears](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.tree-1/grasshopper2-data-itree-pears.md)
- [ITree.Twigs](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.tree-1/grasshopper2-data-itree-twigs.md)
- [ITree.TypeAssistant](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.tree-1/grasshopper2-data-itree-typeassistant.md)
- [IsOrderable](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.tree-1/isorderable.md): Gets whether this tree has orderable items. That is, whether it contains at least one twig with two or more items, not all of whom are nulls.
- [ItemCount](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.tree-1/itemcount.md): Gets the total number of non-null items in this tree.
- [Items](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.tree-1/items.md): Access the items in this tree.
- [LeafCount](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.tree-1/leafcount.md): Gets the number of leaf items in this tree (this includes all items and all nulls).
- [MetaCount](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.tree-1/metacount.md): Gets the number of meta data entries.
- [NonNullItems](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.tree-1/nonnullitems.md): Enumerate over all non-null items in this tree.
- [NonNullPears](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.tree-1/nonnullpears.md): Enumerate over all item/meta data pears in this tree.
- [NullCount](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.tree-1/nullcount.md): Gets the total number of null items in this tree.
- [PathCount](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.tree-1/pathcount.md): Gets the number of paths (and thus twigs) in this tree.
- [Paths](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.tree-1/paths.md): Access the paths of this tree.
- [Pears](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.tree-1/pears.md): Access the pears in this tree.
- [Twigs](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.tree-1/twigs.md): Access the twigs in this tree.
- [Type](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.tree-1/type.md): Gets the type of the data stored in this tree.
- [TypeAssistant](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.tree-1/typeassistant.md): Gets the type assistant (if any) associated with the tree type constraint.
- [TypeFlavour](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.tree-1/typeflavour.md): Gets some information about the generic type parameter of this tree.

## Methods

- [Add](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.tree-1/add.md): (5 overloads) Add a collection of values to this tree.
- [AddNull](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.tree-1/addnull.md): Add null values to this tree.
- [Convert<TQ>](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.tree-1/convert.md): (3 overloads) Convert this tree into one of a different type.
- [ConvertItems<Q>](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.tree-1/convertitems.md): Modify all items in this tree.
- [ConvertPears](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.tree-1/convertpears.md): (2 overloads) Modify all pears in this tree.
- [Filter](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.tree-1/filter.md): (2 overloads) Apply one or more rules to all the twigs and all the items in this tree.
- [Flatten](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.tree-1/flatten.md): (2 overloads) Flatten the entire tree.
- [Flip](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.tree-1/flip.md): Flip the tree by exchanging the twig indices of all items with one of the path elements.
- [GetCoverage](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.tree-1/getcoverage.md): Gets the portion of the tree implied by the coverage.
- [Graft](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.tree-1/graft.md): Perform a graft operation on the entire tree.
- [ITree.ConvertItems<Q>](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.tree-1/grasshopper2-data-itree-convertitems.md)
- [ITree.ConvertPears](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.tree-1/grasshopper2-data-itree-convertpears.md): (2 overloads)
- [ITree.Filter](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.tree-1/grasshopper2-data-itree-filter.md): (2 overloads)
- [ITree.Flatten](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.tree-1/grasshopper2-data-itree-flatten.md): (2 overloads)
- [ITree.Flip](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.tree-1/grasshopper2-data-itree-flip.md)
- [ITree.Graft](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.tree-1/grasshopper2-data-itree-graft.md)
- [ITree.ReplacePath](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.tree-1/grasshopper2-data-itree-replacepath.md)
- [ITree.Split](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.tree-1/grasshopper2-data-itree-split.md): (2 overloads)
- [ITree.WithIncrementalPaths](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.tree-1/grasshopper2-data-itree-withincrementalpaths.md)
- [ITree.WithMetaData](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.tree-1/grasshopper2-data-itree-withmetadata.md): (2 overloads)
- [ITree.WithoutEmptyTwigs](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.tree-1/grasshopper2-data-itree-withoutemptytwigs.md)
- [ITree.WithoutMetaData](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.tree-1/grasshopper2-data-itree-withoutmetadata.md)
- [ITree.WithoutNullItems](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.tree-1/grasshopper2-data-itree-withoutnullitems.md)
- [ITree.WithoutPaths](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.tree-1/grasshopper2-data-itree-withoutpaths.md): (2 overloads)
- [ITree.WithoutSites](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.tree-1/grasshopper2-data-itree-withoutsites.md): (2 overloads)
- [ITree.WithPathPrefix](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.tree-1/grasshopper2-data-itree-withpathprefix.md): (2 overloads)
- [ITree.WithPaths](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.tree-1/grasshopper2-data-itree-withpaths.md)
- [ITree.WithPathSuffix](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.tree-1/grasshopper2-data-itree-withpathsuffix.md): (2 overloads)
- [ITree.WithRandomisedTwigs](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.tree-1/grasshopper2-data-itree-withrandomisedtwigs.md): (2 overloads)
- [ITree.WithRenumberedPaths](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.tree-1/grasshopper2-data-itree-withrenumberedpaths.md): (3 overloads)
- [ITree.WithReversedTwigs](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.tree-1/grasshopper2-data-itree-withreversedtwigs.md)
- [ITree.WithSimplifiedPaths](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.tree-1/grasshopper2-data-itree-withsimplifiedpaths.md)
- [ITree.WithSite](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.tree-1/grasshopper2-data-itree-withsite.md)
- [ITree.WithSortedTwigs](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.tree-1/grasshopper2-data-itree-withsortedtwigs.md)
- [ITree.WithTopology](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.tree-1/grasshopper2-data-itree-withtopology.md)
- [ITree.WithTrimmedPaths](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.tree-1/grasshopper2-data-itree-withtrimmedpaths.md): (2 overloads)
- [IsCoincidentWith](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.tree-1/iscoincidentwith.md): (2 overloads) Test whether a given coverage coincides with this tree.
- [ModifyItems](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.tree-1/modifyitems.md): Create a new tree by replacing all items in this tree by some other value.
- [ModifyPaths](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.tree-1/modifypaths.md): Apply a set of modifier delegates to the paths in this tree.
- [ModifyTwigs](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.tree-1/modifytwigs.md): Apply a set of modifier delegates to the twigs in this tree.
- [NullAt](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.tree-1/nullat.md): (2 overloads) Gets whether a specific item is null or not.
- [ReplacePath](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.tree-1/replacepath.md): Replace one path with another.
- [Similarity](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.tree-1/similarity.md): (2 overloads) Compares two data trees for similarity.
- [Split](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.tree-1/split.md): (2 overloads)
- [ToArrays](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.tree-1/toarrays.md): (3 overloads) Create a nested array of all items and meta data in all twigs. If there is no meta data whatsoever, this array may be returned as null. If the type constraint is a nullable type, the nullData array will be null.
- [ToString](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.tree-1/tostring.md): (2 overloads) Returns a string that represents the current object.
- [TryConvert<TQ>](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.tree-1/tryconvert.md): (3 overloads) Try and convert this tree into a tree of a specific type.
- [WithIncrementalPaths](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.tree-1/withincrementalpaths.md): Simplify the numbering of paths by starting at zero and incrementing by one for each element in the sequence.
- [WithMetaData](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.tree-1/withmetadata.md): (2 overloads) Merge all data from another tree.
- [WithoutEmptyTwigs](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.tree-1/withoutemptytwigs.md): Remove all twigs that contain no items from this tree.
- [WithoutMetaData](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.tree-1/withoutmetadata.md): Clear all meta data from all twigs, but leave items intact.
- [WithoutNullItems](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.tree-1/withoutnullitems.md): Remove all null items from all twigs.
- [WithoutPaths](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.tree-1/withoutpaths.md): (2 overloads) Remove all specified paths and corresponding twigs.
- [WithoutSites](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.tree-1/withoutsites.md): (2 overloads) Remove the specified sites from this tree.
- [WithPathPrefix](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.tree-1/withpathprefix.md): (2 overloads) Prepend an integer to all paths in the tree.
- [WithPaths](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.tree-1/withpaths.md): Copy the paths from another tree while keeping the data from this tree. For a successful path copy, the source and the target trees must have the same number of paths.
- [WithPathSuffix](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.tree-1/withpathsuffix.md): (2 overloads) Append an integer to all paths in the tree.
- [WithRandomisedTwigs](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.tree-1/withrandomisedtwigs.md): (2 overloads) Randomise the items within the twigs of this tree.
- [WithRenumberedPaths](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.tree-1/withrenumberedpaths.md): (3 overloads) Renumber all paths in this tree in ascending order.
- [WithReversedTwigs](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.tree-1/withreversedtwigs.md): Reverse the order of all the items in the twigs of this tree.
- [WithSimplifiedPaths](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.tree-1/withsimplifiedpaths.md): Perform a simplify operation on this tree.
- [WithSite](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.tree-1/withsite.md): (2 overloads) Replace a single pear in this tree.
- [WithSortedTwigs](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.tree-1/withsortedtwigs.md): (2 overloads) Sort all branches using the default comparer.
- [WithTopology](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.tree-1/withtopology.md): Copy the topology of another tree while keeping the data from this tree. For a successful topology copy, the source and the target trees must have the same number of items.
- [WithTrimmedPaths](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.tree-1/withtrimmedpaths.md): (2 overloads) Trim the tree by removing the last element in each path and merging twigs together.
