Order by enum description

前端 未结 6 1628
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-13 10:55

I am working on an ASP.NET MVC projet using EF code first, and I am facing a situation where I need to order by an enum description:

public partial class Ite         


        
6条回答
  •  耶瑟儿~
    2021-01-13 11:17

    To keep it simple and with a good performance, I would order the enum manually, you only have to do it once, and it will help a lot

    public enum MyEnumE
    {
        Enum1 = 3,
        Enum2 = 1,
        Enum3 = 2, // set the order here... 
    }
    

提交回复
热议问题