What are the pros and cons of using a flags enum?
问题 I'm receiving several bit fields from hardware. My code was originally: public readonly byte LowByte; public bool Timer { get { return (LowByte & 1) == 1; } } Then I remembered the flags enum and am considering changing it to: [Flags] public enum LowByteReasonValues : byte { Timer = 1, DistanceTravelledExceeded = 2, Polled = 4, GeofenceEvent = 8, PanicSwitchActivated = 16, ExternalInputEvent = 32, JourneyStart = 64, JourneyStop = 128 } public readonly LowByteReasonValues LowByte; public bool