James Michael Hare

...hare-brained ideas from the realm of software development...
posts - 136 , comments - 1076 , trackbacks - 0

My Links

News

Welcome to my blog! I'm a Sr. Software Development Engineer in Seattle, WA. I've been doing C++/C#/Java development for over 18 years, but have definitely learned that there is always more to learn!

All thoughts and opinions expressed in my blog and my comments are my own and do not represent the thoughts of my employer.

Blogs I Read

MCC Logo MVP Logo

Follow BlkRabbitCoder on Twitter

Tag Cloud

Archives

Post Categories

July 2010 Entries

C# Fundamentals: The Differences Between Struct and Class
This week in C# Fundamentals, we'll tackle the basic differences between C# struct and class types. Sure, this has been discussed many times by many different people, but I believe it's one of those subjects that needs to be brought up over and over again to help people new to the language and refresh people who may have forgotten all the minutia. Introduction: So, what is the difference between a struct and a class? Well, if you have only ever been exposed to the Java world, there is no concept ......

Posted On Thursday, July 29, 2010 8:57 PM | Comments (13) | Filed Under [ My Blog C# Software .NET Fundamentals ]

C# Fundamentals: Combining Enum Values with Bit-Flags
Two posts ago, I talked about the C# enum and some of its pitfalls (here). This post continues with a discussion of the fundamentals of enums by continuing with using enums and bit-flags. Defining a [Flags] Enum Now, we’ve seen previously that enums are typically used when you want to represent a type that can be one of a distinct set of values. But they can also be used to store a combination of discrete values. That is, the standard use of an enumeration is to support mutex options - such as an ......

Posted On Thursday, July 22, 2010 5:46 PM | Comments (9) | Filed Under [ My Blog C# Software .NET Fundamentals ]

C# Toolbox: Building a Loosely Coupled Translator
In my last fundamentals post, Chuck had requested an example of how to translate between enum and int without resorting to casting or other hard-coded mechanisms that depend on the actual values of the enum. One of the problems, of course, with casting between enum and int (for example to represent the enum as an int in database) is that it is a very tightly-coupled bond. Any changes to the underlying data or to the enum could have disastrous consequences. Thus, it is often more desirable to have ......

Posted On Tuesday, July 13, 2010 11:10 PM | Comments (2) | Filed Under [ My Blog C# Software .NET Fundamentals ]

C# Fundamentals: The Joys and Pitfalls of Enums
Continuing on the same vein as my last topic where I discussed differences between C# const and readonly keywords (here) and their uses, today I’m going to look at C# enums and their pitfalls. I will only be discussing the basic enums today (the post got kind of long so I’ll discuss enums marked with the [Flags] attribute next post). Quick Recap of Enums First, a quick recap of enums for those who are brand new or less familiar with them. Basically, enums a great way to declare a variable of a type ......

Posted On Thursday, July 8, 2010 5:53 PM | Comments (5) | Filed Under [ My Blog C# Software .NET Fundamentals ]

C# Fundamentals - What is the Difference Between Const and Readonly?
Once again we delve into the world of C# Fundamentals. Those hints and gotchas that tend to bite folks newer to the language. Today I take another look about the differences between const and readonly and the uses for each. For the purposes of this entry, whenever I say constant i mean a const or readonly. Const – Compile-Time Constant Values First of all, for those of you who came from the C++ and C# world, const in C# is not the same as const in that language. A const in C# can be closest considered ......

Posted On Thursday, July 1, 2010 5:28 PM | Comments (8) | Filed Under [ My Blog C# Software .NET Fundamentals ]

Powered by: