# KeyedLists<TKey, T> class

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

```cs
public sealed class KeyedLists<TKey, T>
```

Represents a palette of keyed lists.

**Type parameters:**

- `TKey`: Key type.
- `T`: List type.

## Constructors

- [KeyedLists<TKey, T>](https://developer.rhino3d.com/api/gh2/type/grasshopper2.collections.keyedlists-2/ctor.md): (2 overloads) Create a new instance of this class with a default comparer.

## Properties

- [DataCount](https://developer.rhino3d.com/api/gh2/type/grasshopper2.collections.keyedlists-2/datacount.md): Gets the total number of items stored in all lists.
- [Items](https://developer.rhino3d.com/api/gh2/type/grasshopper2.collections.keyedlists-2/items.md): Iterate over all items in all lists.
- [KeyCount](https://developer.rhino3d.com/api/gh2/type/grasshopper2.collections.keyedlists-2/keycount.md): Gets the number of keyed lists stored in this structure.
- [Keys](https://developer.rhino3d.com/api/gh2/type/grasshopper2.collections.keyedlists-2/keys.md): Iterate over all keys.
- [KeysCached](https://developer.rhino3d.com/api/gh2/type/grasshopper2.collections.keyedlists-2/keyscached.md): Iterate over all keys. Use this iterator if you wish to add or remove keys to or from this collection while iterating.
- [Lists](https://developer.rhino3d.com/api/gh2/type/grasshopper2.collections.keyedlists-2/lists.md): Iterate over all lists.

## Indexers

- [this[]](https://developer.rhino3d.com/api/gh2/type/grasshopper2.collections.keyedlists-2/item.md): (2 overloads) Gets the list associated with the given key.

## Methods

- [Add](https://developer.rhino3d.com/api/gh2/type/grasshopper2.collections.keyedlists-2/add.md): Add an item to the correct list.
- [AddRange](https://developer.rhino3d.com/api/gh2/type/grasshopper2.collections.keyedlists-2/addrange.md): Add an item to the correct list.
- [ContainsItem](https://developer.rhino3d.com/api/gh2/type/grasshopper2.collections.keyedlists-2/containsitem.md): Gets whether a given key + index is defined within this structure.
- [ContainsKey](https://developer.rhino3d.com/api/gh2/type/grasshopper2.collections.keyedlists-2/containskey.md): Gets whether a given key is defined within this structure.
- [IndexOf](https://developer.rhino3d.com/api/gh2/type/grasshopper2.collections.keyedlists-2/indexof.md): Finds the first occurance of a specific value.
- [Indices](https://developer.rhino3d.com/api/gh2/type/grasshopper2.collections.keyedlists-2/indices.md): (2 overloads) Iterates over all items which match a given predicate.
- [Insert](https://developer.rhino3d.com/api/gh2/type/grasshopper2.collections.keyedlists-2/insert.md): Add an item to the correct list.
- [InsertRange](https://developer.rhino3d.com/api/gh2/type/grasshopper2.collections.keyedlists-2/insertrange.md): Add an item to the correct list.
- [Reassign](https://developer.rhino3d.com/api/gh2/type/grasshopper2.collections.keyedlists-2/reassign.md): Reassign a key. If the new key is already part of the palette, the lists will be merged.
- [Remove](https://developer.rhino3d.com/api/gh2/type/grasshopper2.collections.keyedlists-2/remove.md): Remove a key and list pair from this collection.
- [RemoveAt](https://developer.rhino3d.com/api/gh2/type/grasshopper2.collections.keyedlists-2/removeat.md): Remove an item from the correct list.
- [RemoveEmptyLists](https://developer.rhino3d.com/api/gh2/type/grasshopper2.collections.keyedlists-2/removeemptylists.md): Remove all empty list and key pairs.
- [RemoveRange](https://developer.rhino3d.com/api/gh2/type/grasshopper2.collections.keyedlists-2/removerange.md): Remove items from the correct list.
- [RemoveShortLists](https://developer.rhino3d.com/api/gh2/type/grasshopper2.collections.keyedlists-2/removeshortlists.md): Remove all list which are shorter than some given threshold.
- [TrimExcess](https://developer.rhino3d.com/api/gh2/type/grasshopper2.collections.keyedlists-2/trimexcess.md): Shrink all lists.
