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

  • Home
  • SEARCH
  • 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 643967
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T21:20:25+00:00 2026-05-13T21:20:25+00:00

With enum under .net the biggest number you can use is ULong. This mean

  • 0

With enum under .net the biggest number you can use is ULong.
This mean a maximum of 64 flags.

What would be the alternative when you need more than 64 flags?

Edit

Sorry, I forgot to add this, alternative that would still work with bitwise operations at least these one; and and or.

using Josh Einstein suggestion, I came up with this, does it make sense?

class bitArrayFlag
{
    private const int flagSize = 255; //allow X numbers of flags

    public BitArray flag1;
    public BitArray flag2;
    public BitArray flagN;

    public bitArrayFlag()
    {
        int flagPos = 0;
        bool[] flagBit = new bool[flagSize];

        flagBit[flagPos] = true;
        flag1 = new BitArray(flagBit);

        flagBit[flagPos] = false;
        flagPos += 1;
        flagBit[flagPos] = true;
        flag2 = new BitArray(flagBit);

        //...
        //...
        //...

        flagBit[flagPos] = false;
        flagPos += 1;
        flagBit[flagPos] = true;
        flagN = new BitArray(flagBit);
    }
}
  • 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-05-13T21:20:25+00:00Added an answer on May 13, 2026 at 9:20 pm

    You could then switch to using a BitArray. You would lose all the “features” of an enum such as the default string formatting and parsing ability. A BitArray would be fundamentally similar to having a bunch of boolean fields except that the storage is much more efficient.

    Indeed as Jeff says in the comments with that many independent bit states it seems like an Enum is the wrong solution anyway. A BitArray may be much more suitable for your particular scenario.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Under what circumstances is an enum more appropriate than, for example, a Collection that
public enum myEnum { VAL1(10), VAL2(20), VAL3(hai) { public Object getValue() { return this.strVal;
An enum in Java implements the Comparable interface. It would have been nice to
I have an enum construct like this: public enum EnumDisplayStatus { None = 1,
enum MyEnum { A( 1, 2, 3, 4), B(1, 2), C(4, 5, 8, 8,
I have the following enum declared: public enum TransactionTypeCode { Shipment = 'S', Receipt
I have the following enum: public enum Status implements StringEnum{ ONLINE(on),OFFLINE(off); private String status
I was using an enum in which the constant was a Class. I needed
I have an enum that looks as follows: public enum TransactionStatus { Open =
Given the following java enum: public enum AgeRange { A18TO23 { public String toString()

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.