Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sorting enums by their values #7099

Open
PHILLIPS71 opened this issue May 12, 2024 · 0 comments
Open

Sorting enums by their values #7099

PHILLIPS71 opened this issue May 12, 2024 · 0 comments
Labels
🎉 enhancement New feature or request 🌶️ hot chocolate Next Next up on the backlog.
Milestone

Comments

@PHILLIPS71
Copy link
Contributor

PHILLIPS71 commented May 12, 2024

Product

Hot Chocolate

Is your feature request related to a problem?

Sorting enums based on their values appears to be unattainable at present. Instead, they are sorted by their names, which may suit certain scenarios but can be cumbersome for others.

The solution you'd like

Given the example below, I aim to have the statuses sorted based on their values. Hence, when queried, I anticipate seeing entries in the order of Open, Pending, and Closed.

public enum Status
{
    Open = 0,
    Pending = 1,
    Closed = 2
}

Currently, enums are sorted alphabetically by their names. Consequently, the resulting sort order for entries would be Closed, Open, Pending, which is not preferred in this context.

@PHILLIPS71 PHILLIPS71 added the 🎉 enhancement New feature or request label May 12, 2024
@glen-84 glen-84 changed the title sorting enums by their values Sorting enums by their values May 12, 2024
@michaelstaib michaelstaib added this to the HC-14.0.0 milestone May 13, 2024
@michaelstaib michaelstaib added the Next Next up on the backlog. label May 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🎉 enhancement New feature or request 🌶️ hot chocolate Next Next up on the backlog.
Projects
None yet
Development

No branches or pull requests

2 participants