How to use flags enums in Linq to Entities queries?

后端 未结 8 1045
轮回少年
轮回少年 2021-01-01 04:33

I have a [Flags] enum like this:

[Flags]
public enum Status
{
  None = 0,
  Active = 1,
  Inactive = 2,
  Unknown = 4
}

A Status enum may c

8条回答
  •  鱼传尺愫
    2021-01-01 05:02

    Take a look at the following good post, it shows you the following alternatives:

    • At least one of the selected flags set
    • Exactly the same flags set
    • At least those flags you selected and more

    https://timdams.wordpress.com/2011/02/14/using-enum-flags-to-write-filters-in-linq/#comment-30

提交回复
热议问题