Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8663497
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T16:59:53+00:00 2026-06-12T16:59:53+00:00

We have a database where one of the columns contains composite enum integer values.

  • 0

We have a database where one of the columns contains composite enum integer values. We need to strip all these values (if they have it) of a specific enum integer value, but leave the rest in place.

[Flags]
public enum MyEnum
{
    Enum1 = 1,
    Enum2 = 2,
    Enum3 = 4,
    Enum4 = 8,
}

In the database we find

Row    MyEnumSettings
1      3                   (Enum1 | Enum2)
2      8                   (Enum4)
3      6                   (Enum2 | Enum3)
4      14                  (Enum2 | Enum3 | Enum4)

We want to remove Enum3 from every row and end up with

Row    MyEnumSettings
1      3                   (no change)
2      8                   (no chnage)
3      2                   (removed Enum3)
4      10                  (removed Enum3)

We can use Enum.IsDefined to check if an integer is part of an enum (not sure if it works on composite integer values..). But, how do we check if a given integer value contains a specific part of an enum?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T16:59:54+00:00Added an answer on June 12, 2026 at 4:59 pm

    This should remove the enum if they are bitwisely added:

    Value &= ~Enum3 
    

    Basically you need to bitwisely negate the Enum3 which leads to a negative mask, and apply bitwise AND to exclude the bit which is 0.

    The opposite operation is, if you need to add it back

    Value |= Enum3
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have one database table which contains 8 columns. One of the columns is
i have one database, and it contains some columns. My requirement is that how
i have a large mysql database table in which one column contains values ranging
I have one database which contains two tables: - October2012_ID which contains two columns:
I have some database records, and one of the columns contains the date the
I have a DataSet that contains a few columns. One of these columns is
I have a database with many tables and one particular table has columns: name
I have one database which contains username, password and IsActive (data type is bit)
I have a database containing addresses, one address per Row. Contains every address in
What I have : A C# database query that returns two columns, one of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.