---
title: "User-Defined Types"
url: https://docs.zeroc.com/ice/3.8/slice/user-defined-types
docs_index: https://docs.zeroc.com/llms.txt
---

> For an index of every page, see [llms.txt](https://docs.zeroc.com/llms.txt).

# User-Defined Types

Slice has five kinds of user-defined types:

- An [enumeration](https://docs.zeroc.com/ice/3.8/slice/user-defined-types/enumerations.md) is a type with a fixed set of named values, such as `enum Fruit { Apple, Pear, Orange }`.
- A [structure](https://docs.zeroc.com/ice/3.8/slice/user-defined-types/structures.md) groups named fields, such as the hour, minute, and second of a time of day.
- A [class](https://docs.zeroc.com/ice/3.8/slice/user-defined-types/classes.md) groups named fields like a structure, and also supports inheritance, optional fields, null values, and graphs of instances.
- A [sequence](https://docs.zeroc.com/ice/3.8/slice/user-defined-types/sequences.md) is a variable-length list of elements of the same type.
- A [dictionary](https://docs.zeroc.com/ice/3.8/slice/user-defined-types/dictionaries.md) maps keys of one type to values of another type.

You can combine these types: a structure can hold a sequence, and a dictionary can map keys to structures.

Use a structure rather than a class unless you need one of the capabilities of classes: a class instance takes more time to marshal and unmarshal, and more space on the wire, than a structure with the same fields.
