---
schema_version: "1"
id: efd100b050179e4154ce9ce52f57f5c05fe45f01b3a2aa98653656b9d6dfbd21
title: Enum Methods
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/apexref/apex_methods_system_enum.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_enum.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: 7b8220cdd62678773de2c52ec0d0a2b10245a6d3523139719a901f959b1d05c4
description: An enum is an abstract data type with values that each take on exactly one of a finite set of identifiers that you specify. Apex provides built-in enums, such as LoggingLevel, and you can define your own enum.
---
# Enum Methods

An enum is an abstract data type with values that each take on exactly one of a finite set of identifiers that you specify. Apex provides built-in enums, such as LoggingLevel, and you can define your own enum.

All Apex enums, whether user-defined enums or built-in enums, have these common methods:

- **values**: This method returns the values of the Enum as a list of the same Enum type.
- **valueOf(string enumStr)**: This method converts a specified string to an enum constant value. An exception is thrown if the input string doesn’t match an enum value.

Each Enum value has the following methods that take no arguments.

- **name**: Returns the name of the Enum item as a String.
- **ordinal**: Returns the position of the item, as an Integer, in the list of Enum values starting with zero.

Enum values cannot have user-defined methods added to them.

For more information about Enum, see [Enums](https://developer.salesforce.com/docs/atlas.en-us.264.0.apexcode.meta/apexcode/langCon_apex_enums.htm).

## Example

Integer i = StatusCode.DELETE\_FAILED.ordinal();

String s = StatusCode.DELETE\_FAILED.name();

List<StatusCode> values = StatusCode.values();

StatusCode statusCodeValue = StatusCode.valueOf('delete\_failed');