SmartEnum icon indicating copy to clipboard operation
SmartEnum copied to clipboard

Ordering the values

Open pauldbentley opened this issue 1 year ago • 0 comments

Hi @ardalis I know there has been some discussion here #293 about getting all the enum values.

What is your current approach to displaying enum values in a specific order?

I've potentially thought about adding a new implementation of the List property to my enum type

public static new IReadOnlyCollection<MyEnum> List

And returning the values in the order I want, unless that causes problems in other places this is used.

Or adding a GetAll() but then I think that is confusing when you have the List property.

Adding the source generator in #259 could define an order e.g. [EnumMember(Order = 1)] or some other method i.e. the order in which they are defined on the class, but I don't know the status of this item.

pauldbentley avatar Jul 26 '23 16:07 pauldbentley