Convert an enum to Liststring
Master System Design with Codemia
Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.
Introduction
In C#, the usual way to convert an enum to List<string> is to ask the runtime for the enum names. The shortest answer is Enum.GetNames(typeof(MyEnum)).ToList(), which gives you a list containing each enum member name as a string.
That works well when you want to populate a dropdown, generate labels, or inspect the enum values dynamically. The exact method you choose depends on whether you want the symbolic names, the numeric values, or some custom display text.
Get the Enum Names Directly
For most cases, this is the simplest solution:
Enum.GetNames returns a string array containing the declared member names. Calling ToList() turns it into List<string>.
Convert Values with LINQ
Another common option is to get the enum values and call ToString on each one:
This is slightly more verbose, but it is useful when you want to filter, sort, or transform the values before producing strings.
In newer C# versions you can also use the generic form:
That is often the cleanest version in modern code.
Know What Kind of Strings You Need
There are three common interpretations of this problem:
- enum member names such as
Pending - numeric values such as
0,1,2 - display strings such as
Pending Approval
Enum.GetNames gives you only the member names. If your UI needs friendly text, you may want attributes or a mapping layer instead of raw enum names.
For example, with a custom mapping:
That is better than forcing the enum identifier itself to double as presentation text. It also keeps your public UI language independent from internal naming, which becomes useful when the enum names stay code-friendly but the screen text changes later.
Order and Flags
Enum names are returned in declaration order. That is usually what you want, but it is worth knowing if display order matters. It also means the output is predictable for tests, serialization helpers, and UI components that rely on stable ordering. That predictability is useful in configuration screens and automated assertions.
Also be careful with [Flags] enums. A flags enum represents bit combinations, so converting the declared values to strings is fine, but converting arbitrary combined values may produce composite text that is different from the raw member names.
Common Pitfalls
- Using
Enum.GetValueswhenEnum.GetNameswould be simpler for plain name lists. - Assuming enum names are automatically suitable as user-facing labels.
- Forgetting to call
ToList()when a realList<string>is required instead of an enumerable. - Treating flags enums like ordinary enums without considering combined values.
Summary
- The direct answer is
Enum.GetNames(typeof(MyEnum)).ToList(). - Use
Enum.GetValues<T>().Select(x => x.ToString()).ToList()when you want more control over transformation. - Decide whether you need enum names, numeric values, or friendly display labels.
- Keep UI labels separate from enum identifiers when presentation text matters.
- Be careful with flags enums because combined values behave differently from simple enums.

