Archives
-
Revisited: Enum values as bit flags - using FlagsAttribute
In one of my earlier posts about enum bit flags, using the FlagsAttribute, I incorrectly stated that the actual enum values did not have to be specified. Due to the comments on the post, I ran another test, this time a more conclusive one! See the C# code for this test below.
using System;
public class Test
{
[Flags]
public enum DodgyCarOptions
{
NoExtras,
AirCo,
TintedWindows,
Leather,
SunRoof
}