---
title: MetaEnum class
slug: commerce-connect-13/docs/metaenum-class
docTags: 
createdAt: 2026-07-23T09:44:51.000Z
---

When a new meta-enum is created, a meta-type with the McDataType property and McDataType.Enum value is registered. If an enumerator has been created, you can create a new field with the enumerator meta-type. The entity object property returns the selected item ID (Int32) or an array of selected item IDs (Int32\[]).

:::hint{type="info"}
**Note**
When you create and delete meta-enums, remember that you can only modify a meta-model in **Design** mode. See the [MetaClassManager class](docId\:wHdtKx-T3zjpA9i61de44) section.
:::

## Get an enumerator collection

Because the enumerator is an original meta-type, you can get all enumerators from the MetaClassManager.RegisteredTypes property.

**Example:** Find all enumerators

```csharp
foreach(MetaFieldType type in DataContext.Current.MetaModel.RegisteredTypes)
      {
        if (type.McDataType == McDataType.Enum)
          {
            // The enumerator is found
          }
      }
```

## Manage enumerators

The following MetaEnumclass methods are useful when managing enumerators:

- Call AddItem, passing meta-type, item friendly name and order ID, to add an enum item to the enumerator.
- Call ChangeOrder, passing meta-type, item ID and new order ID, to rename an enum item.
- Call Create, passing type name, friendly name and MultyValue flag, to create a new enumerator.
- Call GetItems, passing meta-type, to get all enum items.
- Call IsUsed, passing meta-type, to determine whether the specified type is used in any meta-class.
- Call Remove, passing meta-type, to delete an enumerator.
- Call RemoveItem, passing meta-type and item ID, to remove an enum item.
- Call RenameItem, passing meta-type, item ID and the new enum name, to rename an enum item.
- Call UpdateItem, passing meta-type, item friendly name and order ID, to update an enum item.

## Create an enumerator

Call the Create method of the MetaEnum class, passing type name, friendly name and MultyValue flag to create a new enumerator.

**Example:** Create a new enumerator

```csharp
MetaFieldType newEnum = MetaEnum.Create(enumName, enumFriendlyName, bMultyValue);
```

## Create an enum meta-field

If you created an enumerator, you can create a new field with the enumerator meta-type.

**Example:** Create an enum meta-field

```csharp
public MetaField CreateEnumField(string name, string friendlyName, string enumName, bool isNullable, string defaultValue, bool enumEditable)
      {
        if (name == null)
        throw new ArgumentNullException("name");
    
        if (friendlyName == null)
        throw new ArgumentNullException("friendlyName");
    
        AttributeCollection attr = new AttributeCollection();
        attr.Add(McDataTypeAttribute.EnumEditable, enumEditable);
        MetaField retVal = this.MetaClass.CreateMetaField(name, friendlyName, enumName, isNullable, defaultValue, attr);
        return retVal;
      }
```
