What is an alternative to bitwise flags?

I was trying to be smart and elegant, and I ended up shooting myself in the foot by coding my entire application to use flags to store various combinations of settings.
Now, I have hit a point where I have > 64 options. I need to move away from flags or I will be forced to create additional fields, which will make my application really messy given its current state.
What should I consider as an alternative to using flags other than creating a separate boolean variable for each option?
By flags, I mean bitwise flags, e.g.:
[Flags]
public enum Time
None = 0
Flag1 = 1,
Flag2 = 2,
Flag3 = 4,
Flag63 = ...

You could use a BitArray in conjunction with static fields to provide labels for the bits:
static class Flags
public static int WorkProperly = 0;
public static int CompileFaster = 1;
public static int AutoImproveCodeQuality = 2;
class FlagTest
static void Main(string[] args)
BitArray bits = new BitArray(100); // > 64
bits[Flags.AutoImproveCodeQuality] = true;
Or, with an enum, but you'd have to cast the value every time:
enum Flags
Never = 0,
MostOfTheTime,
Sometimes,
OddThursdays,
WhenPigsFly
BitArray bits = new BitArray(1000); // lots of bits
bits[(int)Flags.Sometimes] = true;

Similar Messages

  • Did I miss something in the fine print? I installed Lion and and come to find out, I can no longer open any Word documents or Excel spreadsheets as they are no longer supported (being PowerPC apps).  Seriously?!?!?!?!!   What are my alternatives?

    Did I miss something in the fine print? I installed Lion and and come to find out, I can no longer open any Word documents or Excel spreadsheets as they are no longer supported (apparently because they are PowerPC apps).  Seriously?!?!?!?!!   What are my alternatives?

    Hi Mary and Matthew
    You might find it helpful to "try before you buy" - there is a 30 day free trial offer for Office for Mac 2011, accessible from M's .com website.
    You may be able to use this period to open and resave your old documents in a format that enables you to switch instead to using Apple's iWorks apps moving forward.
    I initially intended to do something similar, but ended up buying Office as it provided an easier way (for me, at least) to continue working with years worth of old emails, letters, spreadsheets and other documents (from my PC days) without risking damage to their integrity, formatting, etc.

  • What is the alternative for DisplayMemberPath="Value" for Windows Store applications?

    I think there is a bug with Windows Store Applications when it comes to using DisplayMemberPath="Value".
    Here is my code
    <ComboBox Height="40" VerticalAlignment="Stretch" SelectedValuePath="Key" DisplayMemberPath="Value" x:Name="comboBox1" FontSize="25"/>
    var source = new Dictionary<string, double>();
    source.Add("Item1", 0.4);
    source.Add("Item2", 0.3);
    source.Add("Item3", 0.1);
    source.Add("Item4", 0.1);
    var formateDSource = new Dictionary<string, string>();
    foreach (var item in source)
    formateDSource.Add(string.Format("[{0}, {1}]", item.Key, item.Value), item.Key);
    comboBox1.ItemsSource = source;
    If you use this code in WPF in works perfectly. However if you use this code in a Windows Store Application then the Combo Box is empty and an error is thrown. So is there an alternative way to do this in Windows Store Applications and have I unearthed a
    bug? Because I have researched the Web for days and found no solution to this.*please do not comment unless you have tried my code as a Windows Store App not a WPF in Visual Studios. Can Someone post an example based on my code that works in Windows Store
    Apps please because this is terrible.
    Thanks

    It looks like you got an answer on SO:
    http://stackoverflow.com/questions/29817124/what-is-the-alternative-for-displaymemberpath-value-for-windows-store-applicat
    This does look like a bug.
    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.
    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined
    objects and unknown namespaces.

  • What is an alternative to bins? Sometimes I want to make custom transitions and I need a place to store them for easy use.

    What is an alternative to bins? Sometimes I want to make custom transitions and I need a place to store them for easy use.

    Either projects or events. You can make a compound clip in a event used to hold favorites. Add a couple of generator items to it and apply the custom transition. You can copy and paste from the compound clip to any project. Hold everything you want into the one event. It probably won't ever get very big, and the render files can be dumped at any time. You can simply move the event from machine to machine or place to place as needed, just as you can other custom content, like keyboard layouts and custom color presets.

  • What's the alternative to losing everything?

    Guys I can't believe we lose all these features in iCloud, http://support.apple.com/kb/HT4898 – what is the alternative? Surely Mac would have one? I run 4 computers and need keychains, system preferences, signatures to all be in sync with each other MobileMe was perfect for this... if anyone has any ideas they would be very much appreciated!

    I can't believe that either, that's the only thing I've been using mobileMe for. IPersonally I can't see a single reason why I shoudl upgrade to iCloud.

  • How to export a PowerView report to Power Point in SharePoint Online? If it cannot be done,what is the alternative?

    How to export a PowerView report to Power Point in SharePoint Online? If it cannot be done,what is the alternative?

    Hi Tanay,
    I am not aware of a control you can put in PowerPoint, however, you can insert a web browser control and reference a page in SPO (or maybe even directly the path to the workbook, didn't try that).
    if you are using PowerPoint 2013 take a look
    here
    GALROY

  • What are the alternatives for BOM explosion?

    Hi.
    I am developing a report based on ck13n.I need the product costing of the Whole BOM upto the lowest level. right now i am js gettin the costing of the topmost heirarchy.Hw can i explode the BOM to the lowest level??? what are the alternatives?

    These are the userexits available for the BOM transactions CS11, CS12, CS13.
    Exit Name Description
    PCSD0001 Applications development R/3 BOMS
    PCSD0002 BOMs: Customer fields in item
    PCSD0003 BOMs: Customer fields in header
    PCSD0004 BOM comparison
    PCSD0005 BOMs: component check for material items
    PCSD0006 Mass changes user exit
    PCSD0007 Check changes in STKO
    PCSD0008 WBS BOM: Customer-specific explosion for creating
    PCSD0009 Order/WBS BOM, determine URL page
    PCSD0010 Order/WBS BOM, determine explosion date
    PCSD0011 Knowledge-based order BOM, parallel update
    PCSD0012 Customer - Mat. number/mat. number during material exchange
    PCSD0013 Customer-specific processing of an explosion for BOM browser
    PCSD0014 Knowledge-Based Order BOM: Status
    regards
    Abhay.
    <b>rewards point</b>

  • Is there a Pages for MAC OS 10.7.x? If not, what is the alternative? Concrete issue is that I have received a .pages document and need to edit. Many thanks

    Is there a Pages for MAC OS 10.7.x?
    If not, what is the alternative?
    Concrete issue is that I have received a ".pages" document and need to edit. I am running Mac Pro with OS X 10.7.
    Many thanks

    It is important that you determine if the .pages document originated from Pages ’08, Pages ’09, Pages v1.7.2 (IOS 6), or was exported as Pages ’09 from Pages v5+ on OS X Mavericks. If it meets one of these criteria, then you can edit the .pages document on your Lion machine with Pages ’09 from the iWork ’09 DVD. Pages documents can not be opened with TextEdit, but can be viewed with Preview.
    On the otherhand, if the .pages document was created with Pages for iCloud beta, Pages v2.2.1 (IOS 7), or Pages v5+ on Mavericks, then your only recourse is to edit the document with Pages for iCloud beta. Since Fall 2013, Apple changed the .pages document format into something even more malevolently proprietary. Apple word processing products since this timeframe, are subsets of the Pages ’09 features/functionality, and will filter out content they do not support.
    A Pages ’09 document is usually a compressed (zip) folder archive that looks like a regular file to the Finder. The newer Pages family of products only write out a package that to the Finder, also appears to be a regular file, but in reality it is a folder. The newer Pages documents must be zipped before placed on non-Apple filesystems.

  • What is the alternative to adobe flash on macbook air?

    What kind of alternative do I have to view certain sites? I realize that Adobe Flash is not the best option. Any good and safe alternatives for MacBook Air?
    Thank you.

    There are no proper alternatives as flash is not, and probably never will be, supported on the iPad : http://www.apple.com/hotnews/thoughts-on-flash/ . Plus it would be up to Adobe to make a version of their flash player that works on iOS devices - something which they have never managed to do and which they have now given up on trying to do.
    Browser apps such as Skyfire, iSwifter Puffin and Photon 'work' on some sites, but judging by their reviews not all sites. Also some websites, especially news sites, have their own apps in the App Store, so your could try checking there for your sites (and there is the built-in YouTube app).

  • Firefox OS Simulator 4.0 not available on Firefox 17.0 What is the alternative?

    Why isn't the Firefox OS Simulator 4.0 available on Firefox 17.0? When will it be available? What are the alternatives?

    Hello CKemp, Firefox OS Simulator 4.0 is the latest and works only with Firefox 19.0 and later, for the 17.0 firefox version only the Version 2.0.1 (and 2.0) works.
    sorry but i think the alternatives is to update firefox to latest version, so to work with the latest Firefox OS Simulator 4.0.
    are you talking about 17.0.8esr ?
    thank you

  • What is an alternative download for microsoftt word using a mac bookair?

    what is an alternative download for microsoftt word using a mac bookair?

    Office 2004 and Other Applications Don't Work in Lion/Mountain Lion
    If you have Office 2004 which is a PPC-only suite, it will not work in Lion/Mountain Lion. You need to upgrade to Office 2011 - Mactopia - or you can try the freeware suite, Libre Office, that is functionally similar to Office 2007 for Windows except it works on Lion/Mountain Lion.
    You may want to consider as well:
    These two suites are similar to Libre Office but not as current or as well-supported:
    NeoOffice
    Open Office
    And, then there is Apple's iWork suite:
    Pages - word processing and layout
    Keynote - presentation
    Numbers - spreadsheet
    Each can open and save Office compatible files. They may be purchased separately via the Mac App Store for $19.99 each.
    As for other software, any PPC-based software will not run in Lion or Mountain Lion because Rosetta is no longer part of OS X. You will need to upgrade to Intel versions of the software.
    (Access to the Mac App Store requires Snow Leopard 10.6.6 or higher and an Apple ID.)

  • Icloud won't support iweb websites? What are the alternatives?

    iCloud won't support iweb websites? What are the alternatives?

    You may find this page helpful:
    http://rfwilmut.net/migrate2

  • Whats the best alternative to idvd for burning a disk with pics to play in a dvd player?

    Whats the best alternative to idvd for burning a disk with pics to play in a dvd player? I don't want to deal with older versions of ilife.

    Whats the best alternative to idvd for burning a disk
    In my opinion, there are none.
    Yes, there are other programs that will put a movie on a DVD.   I have tried most of the other substitutes including Toast, Burn, DVD Creator, Wondershare, and others.  None of them come anywhere near the ease-of-use and power of iDVD.
    IDVD is a wonderful piece of software and well worth the low cost of $40.
    http://www.amazon.com/Apple-MC623Z-A-iLife-VERSION/dp/B003XKRZES/ref=sr_1_1?ie=U
    http://dealmac.com/lw/artclick.html?1,527850,1872219

  • If dont have ADOBE FLASH PLAYER... What is the alternative flash player for ipad mini and iphone

    If dont have ADOBE FLASH PLAYER...in mini ipad and iphone.. What is the alternative flash player for ipad mini and iphone

    There is no Flash for iOS and there never will be any Flash.
    Try the newer HTML5 versions of those Web sites that offer it.

  • What is the alternative for pneSearchDocProfiles  in UCM 11g

    Hi
    Any idea what is the alternative for the same in 11g? If I try the same code pneSearchDocProfiles.length always returns "0". As I can see pneCheckinDocProfiles and pneSearchDocProfiles are deprecated in 11g. I know these two are deprecated in 11g and part of deprecated.js file.
    Ashok

    Found the solution and we need use the below given code to find the length of the menu. There is no actual replacement for pneSearchDocProfile and pneCheckinDocProfile we need to use YUI libraries to get access to the menus. Below is the code
    var checkinmenu= YAHOO.widget.MenuManager.getMenu("MENU_A_NEW_CHECK_IN");
         var checkinmenuitems=checkinmenu.getItems();
    navBuilder.deleteItem("MY_PERSONAL_CHECKINS_" + (checkinmenuitems.length-1));
    var checkinmenu= YAHOO.widget.MenuManager.getMenu("MENU_A_SEARCH");
         var searchmenuitems=checkinmenu.getItems();
         navBuilder.deleteItem("MY_PERSONAL_SEARCHES_" + (searchmenuitems.length-1));

Maybe you are looking for

  • Problem camera Recording

    Hello, I have a G20 and on the back of it there is a S-video in port. As far as I know i must then be able to record my camcorder vhs films . Using Intervideo windvd does however nothing. Using pinaclle studio 9 recognizes a tv port but stll no image

  • What is the benefit of static in a method/function

    hello, can u explain the benefit of static in a function? and why i cannot called a function in a static method..example : class jalaninFungsi{      public static void main(String args[])           tesfungsi();      public  void tesfungsi()          

  • Photoshop 7 and Bridge

    I recently ordered CS6 extended, it arrived today. I uninstalled CS5 X fully and proceeded to download my new CS6 X. It turned out to be Photoshop 7, no problem, everything I've tried seems to work BUT I cannot find Bridge. Where is it and/or how do

  • User exit or Badi For MBRL

    Hi all, I am using a y program which call MBRL t-code in back ground . I need  to restrict the t-code MBRL to all user and allow only to use Y program. I can not remove the authorization for MBRL. I found user exit for MBRL but it is in saving time.

  • Logic X won't record through my interface, in-built microphone constantly on

    Installed Logic X on my Macbook Pro, everything seems to work ok but when I try and record Logic is picking up sound through the in-built microphone even though my external interface is selected in the audio preferences box as the input. I tried to s