# LayerTable class

Namespace: [Rhino.DocObjects.Tables](https://developer.rhino3d.com/api/rhinocommon/namespace/rhino.docobjects.tables.md) · Assembly: [RhinoCommon](https://developer.rhino3d.com/api/rhinocommon/assembly/rhinocommon.md)

```cs
public sealed class LayerTable : RhinoDocCommonTable<Layer>, ICollection<Layer>
```

## Properties

- [ActiveCount](https://developer.rhino3d.com/api/rhinocommon/type/rhino.docobjects.tables.layertable/activecount.md): Returns number of layers in the layer table, excluding deleted layers.
- [ComponentType](https://developer.rhino3d.com/api/rhinocommon/type/rhino.docobjects.tables.layertable/componenttype.md)
- [Count](https://developer.rhino3d.com/api/rhinocommon/type/rhino.docobjects.tables.layertable/count.md): Returns number of layers in the layer table, including deleted layers.
- [CurrentLayer](https://developer.rhino3d.com/api/rhinocommon/type/rhino.docobjects.tables.layertable/currentlayer.md): At all times, there is a "current" layer. Unless otherwise specified, new objects are assigned to the current layer. The current layer is never locked, hidden, or deleted. Returns reference to the current layer. Note that this reference may become invalid after a call to AddLayer().
- [CurrentLayerIndex](https://developer.rhino3d.com/api/rhinocommon/type/rhino.docobjects.tables.layertable/currentlayerindex.md): At all times, there is a "current" layer. Unless otherwise specified, new objects are assigned to the current layer. The current layer is never locked, hidden, or deleted. Returns: Zero based layer table index of the current layer.
- [Document](https://developer.rhino3d.com/api/rhinocommon/type/rhino.docobjects.tables.layertable/document.md): Document that owns this table.

## Indexers

- [this[]](https://developer.rhino3d.com/api/rhinocommon/type/rhino.docobjects.tables.layertable/item.md): Conceptually, the layer table is an array of layers. The operator[] can be used to get individual layers. A layer is either active or deleted and this state is reported by Layer.IsDeleted.

## Methods

- [Add](https://developer.rhino3d.com/api/rhinocommon/type/rhino.docobjects.tables.layertable/add.md): (3 overloads) Adds a new layer with default definition to the layer table.
- [AddPath](https://developer.rhino3d.com/api/rhinocommon/type/rhino.docobjects.tables.layertable/addpath.md): (2 overloads) Adds all of the layer in the specified layer path, beginning with the root. Layer paths contain one or more valid layers names, with each name separated by [ModelComponent.NamePathSeparator](https://developer.rhino3d.com/api/rhinocommon/type/rhino.docobjects.modelcomponent/namepathseparator.md). For example, "Grandfather::Father::Son".
- [AddReferenceLayer](https://developer.rhino3d.com/api/rhinocommon/type/rhino.docobjects.tables.layertable/addreferencelayer.md): (2 overloads) Adds a new reference layer with default definition to the layer table. Reference layers are not saved in files.
- [CreateLayer](https://developer.rhino3d.com/api/rhinocommon/type/rhino.docobjects.tables.layertable/createlayer.md): Basic tool used by the add layer methods.
- [Delete](https://developer.rhino3d.com/api/rhinocommon/type/rhino.docobjects.tables.layertable/delete.md): (5 overloads) Deletes layer.
- [Duplicate](https://developer.rhino3d.com/api/rhinocommon/type/rhino.docobjects.tables.layertable/duplicate.md): (2 overloads) Duplicates, or copies, one or more layers. Duplicated layers are added to the document.
- [Find](https://developer.rhino3d.com/api/rhinocommon/type/rhino.docobjects.tables.layertable/find.md): (5 overloads) Finds a layer with a matching ID.
- [FindByFullPath](https://developer.rhino3d.com/api/rhinocommon/type/rhino.docobjects.tables.layertable/findbyfullpath.md): (2 overloads)
- [FindIndex](https://developer.rhino3d.com/api/rhinocommon/type/rhino.docobjects.tables.layertable/findindex.md): Retrieves a Layer object based on Index. This search type of search is discouraged. We are moving towards using only IDs for all tables.
- [FindName](https://developer.rhino3d.com/api/rhinocommon/type/rhino.docobjects.tables.layertable/findname.md): (2 overloads) Finds the next layer that has an index equal or higher than the searched value. Search in case-insensitive.
- [FindNameHash](https://developer.rhino3d.com/api/rhinocommon/type/rhino.docobjects.tables.layertable/findnamehash.md): Finds a Layer given its name hash.
- [FindNext](https://developer.rhino3d.com/api/rhinocommon/type/rhino.docobjects.tables.layertable/findnext.md): (2 overloads)
- [ForceLayerVisible](https://developer.rhino3d.com/api/rhinocommon/type/rhino.docobjects.tables.layertable/forcelayervisible.md): (2 overloads) Makes a layer and all of its parent layers visible.
- [GetEnumerator](https://developer.rhino3d.com/api/rhinocommon/type/rhino.docobjects.tables.layertable/getenumerator.md)
- [GetSelected](https://developer.rhino3d.com/api/rhinocommon/type/rhino.docobjects.tables.layertable/getselected.md): Returns the indices of layers that are selected on the Layer user interface.
- [GetSorted](https://developer.rhino3d.com/api/rhinocommon/type/rhino.docobjects.tables.layertable/getsorted.md): Gets an array of layer indices that are sorted by the values of [Layer.SortIndex](https://developer.rhino3d.com/api/rhinocommon/type/rhino.docobjects.layer/sortindex.md).
- [GetUnusedLayerName](https://developer.rhino3d.com/api/rhinocommon/type/rhino.docobjects.tables.layertable/getunusedlayername.md): (2 overloads) Gets the next unused layer name used as default when creating new layers.
- [Modify](https://developer.rhino3d.com/api/rhinocommon/type/rhino.docobjects.tables.layertable/modify.md): (2 overloads) Modifies layer settings.
- [Purge](https://developer.rhino3d.com/api/rhinocommon/type/rhino.docobjects.tables.layertable/purge.md): (2 overloads) Deletes a layer and all geometry objects on a layer.
- [PurgeUnused](https://developer.rhino3d.com/api/rhinocommon/type/rhino.docobjects.tables.layertable/purgeunused.md): Purges any unused layers.
- [Select](https://developer.rhino3d.com/api/rhinocommon/type/rhino.docobjects.tables.layertable/select.md): Selects layers in the Layer user interface.
- [SetCurrentLayerIndex](https://developer.rhino3d.com/api/rhinocommon/type/rhino.docobjects.tables.layertable/setcurrentlayerindex.md): At all times, there is a "current" layer. Unless otherwise specified, new objects are assigned to the current layer. The current layer is never locked, hidden, or deleted.
- [Sort](https://developer.rhino3d.com/api/rhinocommon/type/rhino.docobjects.tables.layertable/sort.md): Updates the layer sort order
- [SortByLayerName](https://developer.rhino3d.com/api/rhinocommon/type/rhino.docobjects.tables.layertable/sortbylayername.md): Sort layers, in the layer table, by their name in either ascending or descending order. This function sorts layers in the same manner as Rhino's Layers panel.
- [ICollection<Layer>.Add](https://developer.rhino3d.com/api/rhinocommon/type/rhino.docobjects.tables.layertable/system-collections-generic-icollection-rhino-docobjects-layer-add.md)
- [Undelete](https://developer.rhino3d.com/api/rhinocommon/type/rhino.docobjects.tables.layertable/undelete.md): Undeletes a layer that has been deleted by DeleteLayer().
- [UndoModify](https://developer.rhino3d.com/api/rhinocommon/type/rhino.docobjects.tables.layertable/undomodify.md): (4 overloads) Restores the layer to its previous state, if the layer has been modified and the modification can be undone.

## Inherited Members

- From [CommonComponentTable<T>](https://developer.rhino3d.com/api/rhinocommon/type/rhino.fileio.commoncomponenttable-1.md): [Clear](https://developer.rhino3d.com/api/rhinocommon/type/rhino.fileio.commoncomponenttable-1/clear.md), [FindId](https://developer.rhino3d.com/api/rhinocommon/type/rhino.fileio.commoncomponenttable-1/findid.md)
