Top "Enum-flags" questions

How to iterate over values of an Enum having flags?

If I have a variable holding a flags enum, can I somehow iterate over the single-bit values in that specific …

c# enums enum-flags
Flags enum & bitwise operations vs. “string of bits”

A fellow developer suggested we store a selection of days of the week as 7-character string of 1’s and 0’s, …

c# bit-manipulation enum-flags
Why are flag enums usually defined with hexadecimal values

A lot of times I see flag enum declarations that use hexadecimal values. For example: [Flags] public enum MyEnum { None = 0…

c# .net enums enum-flags
Model Bind List of Enum Flags

I have a grid of Enum Flags in which each record is a row of checkboxes to determine that record's …

c# asp.net-mvc asp.net-mvc-3 model-binding enum-flags
How to set all bits of enum flag

I wonder a generic way for setting all bits of enum flag to 1. I just would like to have an …

c# enums enum-flags
C#: Getting the correct keys pressed from KeyEventArgs' KeyData

I am trapping a KeyDown event and I need to be able to check whether the current keys pressed down …

c# enums enum-flags keyeventargs
C#, Flags Enum, Generic function to look for a flag

I'd like one general purpose function that could be used with any Flags style enum to see if a flag …

c# enums enum-flags
Append Enum Flags to a Parameter in a Loop (Bitwise Appending)

In C#, I am trying to "add" values to a parameter that accepts enumerated flags. I can do it on …

c# bit-manipulation enum-flags
C# Enums - Check Flags against a Mask

I have the following enum flags: [Flags] private enum MemoryProtection: uint { None = 0x000, NoAccess = 0x001, ReadOnly = 0x002, ReadWrite = 0x004, WriteCopy = 0…

c# .net enums flags enum-flags
Should "or" work with .Net4 Hasflags: enum.HasFlag(AccessRights.Read | AccessRights.Write)

I am trying out the new HasFlags features, and was wondering if the following should work: enum.HasFlag(AccessRights.Read | …

c# .net-4.0 enums enum-flags