# TreeExtensionMethods class

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

```cs
public static class TreeExtensionMethods
```

## Methods

- [EnumerateLeaves<T>](https://developer.rhino3d.com/api/gh2/type/grasshopper2.extensions.treeextensionmethods/enumerateleaves.md): (2 overloads, static) Enumerate over all pears in a tree and their associated sites.
- [ExpandEmbeddedCollections](https://developer.rhino3d.com/api/gh2/type/grasshopper2.extensions.treeextensionmethods/expandembeddedcollections.md): (4 overloads, static) Process a tree and automatically convert all linear enumerations and trees stored as items into new twigs and sub-trees. This method is recursive and keeps replacing embedded collections until no more changes happen.
- [RepairPears](https://developer.rhino3d.com/api/gh2/type/grasshopper2.extensions.treeextensionmethods/repairpears.md): (2 overloads, static) Find all places where [IPear](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.ipear.md) instances are assigned as twig items and promote them to the proper structure.
- [ToNullAwareArray](https://developer.rhino3d.com/api/gh2/type/grasshopper2.extensions.treeextensionmethods/tonullawarearray.md): (static) Gets an array of doubles with all null values set to NaN.
