# Collections

### Supported types

Arrays and lists:

* `T[]`
* `List<T>`
* `IEnumerable<T>` (backed by `T[]`)
* `IReadOnlyList<T>`(backed by `T[]`)
* `IReadOnlyCollection<T>`(backed by `T[]`)
* `ICollection<T>` (backed by `List<T>`)
* `IList<T>`(backed by `List<T>`)

Dictionaries:

* `Dictionary<TKey, TValue>`
* `IDictionary<TKey, TValue>` (backed by `Dictionary`)
* `IReadOnlyDictionary<TKey, TValue>` (backed by `Dictionary`)

Sets:

* `HashSet<T>`
* `ISet<T>` (backed by `HashSet`)

Collections can have [classes, structs](classes-and-structs) and other collections as elements.

### Binder requirements

Collections require binders defined for element types (both keys and values in case of dictionaries).

### Node requirements

[Array](../concepts-and-basics/settings-nodes/array-nodes) or [object](../concepts-and-basics/settings-nodes/object-nodes) node. Empty nodes are converted to empty collections.

### Null node handling

An empty collection is returned unless [explictly required](../basic-scenarios/make-settings-required).

Nulls are not valid as dictionary keys.

### Error handling

Any element binding failure results in complete collection binding failure.

### Comparer customization

A custom element comparer (such as `StringComparer.OrdinalIgnoreCase` for case-insensitive dictionary keys) can be achieved by wrapping the collection in a custom type and utilizing the [constructor binding convention](constructors).

### Related pages

{% content-ref url="../concepts-and-basics/binding-nodes-to-models" %}
[binding-nodes-to-models](../concepts-and-basics/binding-nodes-to-models)
{% endcontent-ref %}

{% content-ref url="constructors" %}
[constructors](constructors)
{% endcontent-ref %}
