My codeproject article on .NET enumerated types.
http://www.codeproject.com/Articles/91195/NET-Enumerated-Types-Explained
Introduction
The purpose of this article is to provide an introduction to .NET enumerated types.
Background
Code readability is a big factor when considering the quality of source code. The easier code is to understand, the easier it is to maintain. Have you ever found yourself using numbers to represent a range of variable values? For example:
Collapse | Copy Code
Dim CalculationOperation As Integer = 0
CalculationOperation = _ GetOperation ()
Select Case CalculationOperation
Case 1 ’ Addition
_PerformAddition()
Case 2 ‘ Subtraction
_PerformSubtraction()
Case 3 ‘ Multiplication
_PerformMultiplication()
End Select
This requires you as well as any other developers that might touch your code to remember all of the possible numeric values that represents colors. This can be a maintenance nightmare! To solve this problem, VB.NET has enumerated types.
Reasons to Use Enumerated Types
Readability
From Wikipedia:
"In computer programming, an enumerated type (also called enumeration or enum) is a data type consisting of a set of named values called elements, members or enumerators of the type. The enumerator names are usually identifiers that behave as constants in the language."
Enumerated types allow you to give an English description to a range of integer values. Perhaps an example will explain this.
Collapse | Copy Code
Public Type CalculatorOperations
Addition = 1
Subtraction = 2
Multiplication = 3
End Type
Dim Operation As CalculatorOperations
Operation = _ GetOperation ()
Select Case Operation
Case CalculatorOperations.Addition
_PerformAddition()
Case CalculatorOperations.Subtraction
_PerformSubtraction()
Case CalculatorOperations.Multiplication
_PerformMultiplication()
End Select
This routine is easier to read.
When coding a routine, be sure to consider numeric literals that represent a value other than the number itself as a possible reason to create an enumerated type.
Enums as Routine Parameters
Enumerated types are great as routine parameters. Consider the following example.
Bad Example
Collapse | Copy Code
Dim ApplicationState as Integer = 5 ‘lets say five stands for Fatal Crash!
Sub _SetApplicationState(ByVal State As Integer)
Good Example
Collapse | Copy Code
Dim ApplicationState As AppState = AppState.FatalCrash
Sub _SetApplicationState(ByVal State As AppState)
If you are using Visual Studio, then you no doubt have noticed the benefit of using enumerated types as function parameters. While you are writing the code to call the routine, intellisense will show you all available members of the enumerated type.
Compiler Type Checking
Using enumerated types also provides type checking by the compiler. Consider the following block of code:
Collapse | Copy Code
‘Valid color values are 0 – 9
Dim CurrentColor As Integer
CurrentColor = 12 ‘invalid color
This is impossible with enumerated types. Enumerated types can make powerful return values. Consider the following code:
Collapse | Copy Code
Dim LoginResult As Boolean = false
LoginResult = _AttemptLogin()
If LoginResult = True Then
_Authenticateuser()
End If
If LoginResult = False Then
_InitiateLogin()
End If
As you can see, true and false allow for two conditions:
Collapse | Copy Code
Dim LoginResult As AuthResult
LoginResult = _AttemptLogin()
If LoginResult = AuthResult.Authenticated Then
_Authenticateuser()
End If
If LoginResult = AuthResult.Failed Then
_InitiateLogin()
End If
If LoginResult = AuthResult.Suspended Then
_AlertSuspended()
End If
If LoginResult = AuthResult.AuthenticatedChangePassword Then
_InitiatePasswordChange()
_AuthenticateUser()
End If
Do you see the possibilities?
Define the First and Last Entry as Loop Limits
You may find yourself in a situation where you need to iterate through each member of your enumerated type. One suggested practice is to reserve the first and last element as loop limits.
Collapse | Copy Code
Public Type RGBValue
RGB_FirstValue = 0
RGB_Red = 0
RGB_Green = 1
RGB_Blue = 2
RGB_LastValue = 2
End Type
Dim RGBVal As RGBValue
For RGBVal = RGBValue.RGB_FirstValue To RGBValue.RGB_LastValue
‘process here
Next
Here is an example of iterating through an enum.
'Imagine if you had an enum for EmployeeTypes and you 'wanted to iterate over 'each employee type and perform an 'action.
'For instance
Public Type EmployeeType
Cashier = 0
Supervisor = 1
Manager = 2
Executive = 3
End Type
Dim employeeType As EmployeeType
For employeeType = EmployeeType.Cashier To EmployeeType.Executive
CalculateRaise(employeeType)
Next
Conclusion
Well, I hope I’ve illustrated some of the benefits of using enumerated types. All of your feedback is welcome.

Here is my post from http://www.codeproject.com/Articles/89460/Why-Learn-Assembly-Language
"Assembly language? Isn't that the hard to read instructions on how to assemble your brand new computer desk?"...
No..
What is Assembly Language?
x86 Assembly is a programming language for the x86 class of processors (specifically the 32bit x86 processors IA-32 - http://en.wikipedia.org/wiki/IA-32). The instruction set defined by the IA-32 architecture is targeted towards the family of microprocessors installed in the vast majority of personal computers on the planet. Assemblylanguage is machine specific and considered a "low level" language. This means that the code and syntax is much closer to the computer's processor, memory, and I/O system. A high level language is designed with keywords, libraries, and a syntax that introduces a high level of abstraction between the language and the hardware.
Background
I thought assembly was a dead language, why waste the time?
Though it's true, you probably won't find yourself writing your next customer's app in assembly, there is still much to gain from learning assembly. Today, assembly language is used primarily for direct hardware manipulation, access to specialized processor instructions, or to address critical performance issues. Typical uses are device drivers, low-level embedded systems, and real-time systems (EDIT:Thanks Trollslayer). The fact of the matter is, the more complex high level languages become, and the more ADT (abstract data types) that are written, the more overhead is incurred to support these options. In the instances of .NET, perhaps bloated MSIL. Imagine if you knew MSIL. This is where assembly language shines. (EDIT)Assembly language is as close to the processor as you can get as a programmer so a well designed algorithm is blazing -- assembly is great for speed optimization. It's all about performance and efficiency. Assembly language gives you complete control over the system's resources. Much like an assembly line, you write code to push single values into registers, deal with memory addresses directly to retrieve values or pointers. To write in assembly is to understand exactly how the processor and memory work together to "make things happen". Be warned, assembly language is cryptic, and the applications source code size is much much larger than that of a high-level language. But make no mistake about it, if you are willing to put in the time and the effort to master assembly, you will get better, and you will become a stand out in the field.
So why should you care?
Points of Interest
Wirth's Law
I remember dialling into a BBS on my 486 with my brand new 2400bps modem. Fast-forward 14 years and now we are only limited by our imagination. With all of these amazing technological breakthroughs, there is a glaring anomaly; a paradox. This is referred to as Wirth's law. Wirth's law states that software is getting slower more rapidly than hardware becomes faster. There's no one reason why this is the case, but I'd like to think that the further we as developers drift away from the lower level details of software development, we write less than stellar (inefficient code). Hold the phone! I'm not calling anyone stupid. It's just that these new languages and supercharged processors have abstracted us so far from the machine, that we no longer have to be concerned with things like garbage collection, variable initialization, memory address pointers, etc. All of these features and more are now standard in today's languages/runtimes/IDEs. The result is a new breed of developers that rely on superior hardware power for performance rather than striving to write concise, cohesive, efficient code.
My Eyes are Open!
I realize now that learning assembly language will teach me about the inner workings of the computer. I'll learnhow the CPU/CPU registers work with memory addresses to achieve the end result one instruction at a time. This doesn't mean that I'm going to begin coding everything in assembly, however, I will learn which data types to use and when. I'll learn how to write smaller, faster, more efficient routines. I will understand software development at a level that most of my peers don't. I'm even opening up to the possibility of looking into writing my own compiler.
So if you are serious about getting a leg up on the competition in your field, I'd recommend trying to learnassembly language.
Resources on Learning Assembly
How To Use Debug - http://www.codeproject.com/KB/miscctrl/Debug.aspx
Introduction to x86 Assembly Language
http://www.c-jump.com/CIS77/ASM/Assembly/lecture.html

About the author

My name is Buddy James. I'm a Microsoft Certified Solutions Developer from the Nashville, TN area. I'm a Software Engineer, an author, a blogger (http://www.refactorthis.net), a mentor, a thought leader, a technologist, a data scientist, and a husband. I enjoy working with design patterns, data mining, c#, WPF, Silverlight, WinRT, XAML, ASP.NET, python, CouchDB, RavenDB, Hadoop, Android(MonoDroid), iOS (MonoTouch), and Machine Learning. I love technology and I love to develop software, collect data, analyze the data, and learn from the data. When I'm not coding, I'm determined to make a difference in the world by using data and machine learning techniques. (follow me at @budbjames).