Click here to Skip to main content
15,896,201 members
Articles / Programming Languages / C# 4.0

Ending the Great Debate on Enum Flags

Rate me:
Please Sign up or sign in to vote.
4.92/5 (155 votes)
9 Aug 2013CPOL9 min read 219.4K   623   161  
This article explains how enumeration and flags work in C#.NET and how to properly use them.
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following 
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("EnumExample")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("ECRI Institute")]
[assembly: AssemblyProduct("EnumExample")]
[assembly: AssemblyCopyright("Copyright © ECRI Institute 2011")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible 
// to COM components.  If you need to access a type in this assembly from 
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("db8de061-22c8-42ef-b4a6-c29d8f7b0ae0")]

// Version information for an assembly consists of the following four values:
//
//      Major Version
//      Minor Version 
//      Build Number
//      Revision
//
// You can specify all the values or you can default the Build and Revision Numbers 
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Incycle Software
United States United States
I've been a .NET developer since 2006 when I graduated college. I've had lots of opportunities over the years to work on various projects in various industries. In the last few years, I've found my true calling in the DevOps arena. Now, you find me helping companies do better at developing software. When I'm actually away from keyboard, not tinkering with some new technology or side project, you'll find me actively volunteering in my community as EMT/Firefighter.

Comments and Discussions