# Path 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
[IoId("00000000-4edf-4b84-8cc9-4112a11949d4")]
public sealed class Path : IComparable<Path>, IEquatable<Path>, IStorable
```

Paths are used to identify twigs in data trees. Paths are ordered, immutable collections of non-negative integers.

## Constructors

- [Path](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.path/ctor.md): (3 overloads) Create a new instance of TreePath based on a collection of indices.

## Fields

- [Zero](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.path/zero.md): (static) Gets the single element path with a value of zero: {0}
- [ZeroZero](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.path/zerozero.md): (static) Gets the double element path with two zeroes: {0, 0}

## Properties

- [LastElement](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.path/lastelement.md): Gets the last element in the path.
- [Length](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.path/length.md): Gets the number of elements in this path.
- [OnlyZeroes](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.path/onlyzeroes.md): Gets whether this path contains only zeroes.

## Indexers

- [this[]](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.path/item.md): Gets the path element at the given index.

## Methods

- [AllUnique](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.path/allunique.md): (static) Check whether a collection of paths has any collisions.
- [AppendElement](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.path/appendelement.md): Create a new path by appending a new rule to this path.
- [CompareTo](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.path/compareto.md): Compare this path to another one.
- [Contains](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.path/contains.md): Test to see if this path contains the specified elements.
- [CountElements](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.path/countelements.md): (2 overloads) Count the number of times this path contains elements in the given range.
- [CreateFromZeroes](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.path/createfromzeroes.md): (static) Create a path filled with zeroes of a specific length.
- [EndsWith](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.path/endswith.md): Test to see if this path ends with the specified elements.
- [Equals](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.path/equals.md): (2 overloads) Test this path for equality with another path.
- [EstimateNextPath](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.path/estimatenextpath.md): (2 overloads, static) Try and estimate the most sensible addition to a list of paths.
- [FindReplace](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.path/findreplace.md): (2 overloads) Replace specific elements in this path with other elements.
- [FormatPathLikeString](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.path/formatpathlikestring.md): (2 overloads, static) Format a collection of strings as a path.
- [GetHashCode](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.path/gethashcode.md): Compute the hash code for this path.
- [Increment](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.path/increment.md): (2 overloads) Increment this path by one. The rightmost non-zero value is incremented, or, if all values are zero, the rightmost value is set to 1.
- [IndexOf](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.path/indexof.md): (2 overloads) Finds the first occurance of a string of integers within the path.
- [MakeUnique](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.path/makeunique.md): Make sure the current path is unique amongst a collection of paths.
- [Offset](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.path/offset.md): Offset an element in this path
- [PadLeft](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.path/padleft.md): Pad a pad on the leading edge until it reaches a certain length.
- [PadRight](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.path/padright.md): Pad a pad on the trailing edge until it reaches a certain length.
- [ParsePattern](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.path/parsepattern.md): (static) Try and parse a string that may represent some sort of path notation, yielding a view of each element and of the item. Nothing is said about what the elements contain, so this reads the wildcards and expressions of path mapping as readily as it reads the whole numbers of a data path.
- [PrependElement](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.path/prependelement.md): Create a new path by prepending a new rule to this path.
- [RemoveElements](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.path/removeelements.md): (2 overloads) Remove all elements that are between two extremes.
- [RemoveFirstElement](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.path/removefirstelement.md): Create a new path by removing the first element from this path.
- [RemoveLastElement](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.path/removelastelement.md): Create a new path by removing the last rule from this path.
- [Replace](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.path/replace.md): Replace a specific element in this path with another.
- [ReplaceLastElement](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.path/replacelastelement.md): Replaces the last element in this path with a different value.
- [StartsWith](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.path/startswith.md): Test to see if this path starts with the specified elements.
- [Store](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.path/store.md): Store this path in an IO archive.
- [SubPath](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.path/subpath.md): Create a path that is a subset of this path.
- [SwapElements](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.path/swapelements.md): Create a new path by swapping two elements in this path.
- [ToArray](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.path/toarray.md): Get a copy of the elements in this path.
- [ToString](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.path/tostring.md): (2 overloads) Get the string representation of this path.
- [TryParse](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.path/tryparse.md): (static) Parse a string for path notation. This method throws no exceptions, but instead returns error messages via the message argument.

## Operators

- [operator +](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.path/op-addition.md): (3 overloads, static) Prepend an item to a path.
- [operator ==](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.path/op-equality.md): (static) Compare two Path instances for equality.
- [operator >](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.path/op-greaterthan.md): (static) Test whether A is larger than B.
- [operator >=](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.path/op-greaterthanorequal.md): (static) Test whether A is larger than or equal to B.
- [operator !=](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.path/op-inequality.md): (static) Compare two Path instances for inequality.
- [operator <](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.path/op-lessthan.md): (static) Test whether A is smaller than B.
- [operator <=](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.path/op-lessthanorequal.md): (static) Test whether A is smaller than or equal to B.
- [operator *](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.path/op-multiply.md): (static) Multiply each index in this path by the given factor.

## Convertors

- [operator implicit](https://developer.rhino3d.com/api/gh2/type/grasshopper2.data.path/op-implicit.md): (7 overloads, static) Convert a path to an integer array.
