James Michael Hare

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

My Links


Welcome to my blog! I'm a Sr. Software Development Engineer who has been performing C++/C#/Java development for over 20 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

Follow BlkRabbitCoder on Twitter

Tag Cloud

Article Categories


Image Galleries



Little Wonders

Little Wonders



There are 8 entries for the tag Fundamentals
C#/.NET Fundamentals: Three Tech.Pro Tutorials
I know I’ve been a bit quiet on my blog lately. I’ve still been adjusting to my new life in Seattle and learning different technologies for my new job. It’s been a lot of fun, but has left me with precious little free time! That said, a few months ago I was invited to throw together some tutorials on Tech.Pro as part of their startup series, so I decided to give it a go. Their site has a nice collection of tutorials of various skill level ratings from several different authors. These were the tutorials ......

Posted On Thursday, May 2, 2013 9:09 PM | Comments (0) |

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 | Comments (12) |

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 8, 2011 6:32 PM | Comments (9) |

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 1, 2011 8:10 PM | Comments (15) |

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 4, 2010 7:04 PM | Comments (9) |

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 | Comments (4) |

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 (10) |

C# Fundamentals: String Concat() vs. Format() vs. StringBuilder
I was looking through my groups’ C# coding standards the other day and there were a couple of legacy items in there that caught my eye. They had been passed down from committee to committee so many times that no one even thought to second guess and try them for a long time. It’s yet another example of how micro-optimizations can often get the best of us and cause us to write code that is not as maintainable as it could be for the sake of squeezing an extra ounce of performance out of our software. ......

Posted On Monday, May 10, 2010 9:59 PM | Comments (6) |

Powered by: