DEV Community

Discussion on: Taking advantage of BitMasks

Collapse
 
rubberduck profile image
Christopher McClellan • Edited

Something that makes things a little more clear and easy to work with is if you define the enum in terms of powers of 2.

[Flags]
public enum errors
{
    Name = 2^0,
    Date = 2^1,
    Time = 2^2,
    // etc.
}

Sadly, C# lacks a power operator.