James Michael Hare

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

My Links

News

Welcome to my blog! I'm a solutions architect at Scottrade Inc. in Saint Louis, MO. I've been doing C++/C# 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.

MCC Logo MVP Logo

Follow BlkRabbitCoder on Twitter

Tag Cloud

Archives

Post Categories

Fundamentals

There are 6 entries for the tag Fundamentals
C#/.NET Fundamentals: Unit Testing with Func<TResult> Generators
The C#/.NET Fundamentals series is geared towards examining fundamental concepts in using C# (and .NET in general) to produce effective solutions. I wanted to attempt a brief post before the holidays, so I decided to quickly revisit part a post I wrote a few weeks back on The Generic Func Delegates, and in particular, the sidebar on using Func as a generator for unit testing. At the time, I did not give that short sidebar the attention I really wanted, including showing the setup of the unit tests...

Posted On Thursday, December 22, 2011 5:33 PM | Feedback (11) | Filed Under [ My Blog C# Software .NET Fundamentals ]

C#/.NET Fundamentals: Returning Zero or One Item As IEnumerable<T>
The C#/.NET Fundamentals series is geared towards examining fundamental concepts in using C# (and .NET in general) to produce effective solutions. There are times when we are writing a method that returns a sequence of items, that it occasionally becomes necessary in base-class, interface implementation, error, or default conditions to return a sequence of only one or even zero items. There are many ways to do this, of course, which begs the question of which way is best, in terms of readability,...

Posted On Thursday, December 08, 2011 6:32 PM | Feedback (9) | Filed Under [ My Blog C# Software .NET Fundamentals ]

C#/.NET Fundamentals: Safely and Efficiently Raising Events
The C#/.NET Fundamentals series is geared towards examining fundamental concepts in using C# (and .NET in general) to produce effective solutions. A couple of posts ago, I discussed the EventHandler<TEventArgs> and EventHandler delegates, and in particular at one point mentioned in a sidebar that you need to watch out for thread-safety in order to safely raise events in a multi-threaded environment. There was an interesting discussion in the comments about different ways that people achieve...

Posted On Thursday, December 01, 2011 8:10 PM | Feedback (10) | Filed Under [ My Blog C# Software .NET Fundamentals ]

C#/.NET Fundamentals: Returning an Immutable Collection
Last week we discussed returning immutable POCOs from an enclosing class so that you can prevent someone who asks for your class’s data to mutate it out from under you. Now we’re going to get a little more complex and talk about returning immutable collections from an enclosing class for the same reasons. I will discuss several different methods for returning collections in a read-only fashion with their pros and cons, including performance implications. The Problem Many times you will create a type...

Posted On Thursday, November 04, 2010 7:04 PM | Feedback (6) | Filed Under [ My Blog C# Software .NET Fundamentals ]

C#/.NET Fundamentals: Returning Data Immutably in a Mutable World
One of the things I sort-of miss from C++ (it has its good and bad) is the const modifier. Yes, while it’s true that we have a const modifier in C# (as well as readonly), but it’s not quite as robust. Many times you’ll want to return an internal member of a class but not want it to be directly modifiable by the user of that class. This article discusses how to present simple types as read-only. Note: I’m deliberately avoiding creating read-only views of collections in this particular article, but...

Posted On Thursday, October 28, 2010 6:21 PM | Feedback (4) | 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 | Feedback (7) | Filed Under [ My Blog C# Software .NET Fundamentals ]

Powered by: