# Maths.IndexMap class

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

```cs
public sealed class Maths.IndexMap : IEquatable<Maths.IndexMap>
```

An integer array of length N containing all the integers from 0 to N-1. This map encodes a specific (re)ordering of items in an array. Grasshopper uses index mapping instead of in-place sorting so that a specific ordering can be cheaply applied to more than one collection.

## Constructors

- [Maths.IndexMap](https://developer.rhino3d.com/api/gh2/type/grasshopper2.maths.indexmap/ctor.md): Create a new index map. The validity of the map is not tested. If you are suspicious about a map you must call Validate() yourself.

## Properties

- [Array](https://developer.rhino3d.com/api/gh2/type/grasshopper2.maths.indexmap/array.md): Return the internal array. Note that this does not create a copy of the array, so changes made to the returned instance will modify this index map. Do so at your own peril.
- [Length](https://developer.rhino3d.com/api/gh2/type/grasshopper2.maths.indexmap/length.md): Gets the size of this map.

## Indexers

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

## Methods

- [Apply<T>](https://developer.rhino3d.com/api/gh2/type/grasshopper2.maths.indexmap/apply.md): Apply this mapping to an existing array.
- [Combine](https://developer.rhino3d.com/api/gh2/type/grasshopper2.maths.indexmap/combine.md): (static) Combine multiple maps into a single map which encodes the ordering of both.
- [Equals](https://developer.rhino3d.com/api/gh2/type/grasshopper2.maths.indexmap/equals.md): (2 overloads)
- [GetHashCode](https://developer.rhino3d.com/api/gh2/type/grasshopper2.maths.indexmap/gethashcode.md)
- [Identity](https://developer.rhino3d.com/api/gh2/type/grasshopper2.maths.indexmap/identity.md): (static) Create an identity mapping of the given length.
- [Invert](https://developer.rhino3d.com/api/gh2/type/grasshopper2.maths.indexmap/invert.md): Invert the index map. This can also be used to create an array of integers which can be used as sorting keys.
- [Validate](https://developer.rhino3d.com/api/gh2/type/grasshopper2.maths.indexmap/validate.md): Ensure that each integers from zero to count-1 appears exactly once in this mapping.
