Tag Info

New answers tagged


Sorry for posting something off topic. Anyways, since the damage has already been done, here is what I came up with in case anyone else has the same problem. The Flags attribute way consisted of several tricky pitfalls. For example, bit shifs on signed ints are arithmetic so the sign bit can't be easily used. Also, reconstructing the array of flags from a ...


Expanding on @Telastyn's answer, you can declare your flags as an enum with the Flags attribute instead of using an array of booleans: [Flags] public enum Options : uint { Empty = 0, FancyClouds = 1, EnhancedGrassTextures = 2, HiDefNoses = 4, NoPantsMode = 8, // etc. values are increasing powers of 2 up to 2^31 } You can fiddle ...


Yes, there is a Flags attribute that lets you use enums as flags for an int, and the type has methods to help identify if a flag is set and the such.

Top 50 recent answers are included