How can I get a set of Enums except one using Linq?

I have a set of enumerations

public enum SyncRequestTypeEnum
{
 ProjectLevel=1,
 DiffSync=2,
 FullSync=3
}

I want to display these enumerations in a dropdown list other than ProjectLevel. Can I get this data using linq? Can anyone help with this?

+4
source share
1 answer

Maybe something like this:

var result = Enum
        .GetValues(typeof(SyncRequestTypeEnum))
        .Cast<SyncRequestTypeEnum>()
        .Where(w =>w!=SyncRequestTypeEnum.ProjectLevel)
        .ToList();
+8
source

Source: https://habr.com/ru/post/1544702/


All Articles