pass by reference value, pass by value, ref and out

I want to start this post by defining what a reference type is and what a value type is. We’ll start with reference types. These are all objects that are not value types, pretty easy, huh? 🙂 So what are value types? Per the documentation they are numeric types (like int, decimal, float and other […]

.

Read more

Lazy and the Singleton Pattern

There are a lot of threading issues that are fairly obvious which careful and conservative use of locks will solve. Conservative use is import because if we use locks too liberally we run the risk of turning all the work we’ve done to multi-thread back into a single thread scenario. The subtle issues are the […]

.

Read more

Recommended pattern for event declaration and handling

Custom event handlers should always follow this pattern: All I’ve done that is special here is declared the event handler with an empty delegate. This provides two advantages (the big one being the second). As a clearer, more complete example imagine we have the following code: but just by modifying the event declaration to: you […]

.

Read more

Collection was modified; enumeration operation may not execute.

I’m sure one of the first exceptions any of us get as C# devs is when we try to iterate over a List (or other enumerable) and attempt to remove an item. This results in the exception: InvalidOperationException was unhandled. Collection was modified; enumeration operation may not execute. The easy solution is just to create […]

.

Read more

NFop (ApacheFop.Net) with J# in .NET 4.0 and DotNetNuke 6

Recently we had a client that wanted to upgrade their web application containing modules we had written for them a long time ago for DotNetNuke 4.3 and they hadn’t had any upgrades since.  Fortunately the content on the site was fairly minimal so we decided just to set up a new instance of DNN 6 […]

.

Read more

The Task Parallel Library and System.Collections.Concurrent Namespace

Arguably one of the biggest parts of .NET 4.0 was the Task Parallel Library (TPL). The TPL makes it ridiculously easy to parallelize code. With Parallel.ForEach, Parallel.For, Parallel.Invoke, and Task.Factory developing for today’s multi-core systems should be a matter of fact. Recently I was tasked with optimizing a large code base to utilize the TPL. […]

.

Read more

String comparisons

At one of the blogs I most frequent there was a post asking, “Where is the bug?”. In the comments section it was mentioned, Use ToUpperInvariant rather than ToLowerInvariant when normalizing strings for comparison. Sure enough if you go to the Microsoft page on it, it says Use the String.ToUpperInvariant method instead of the String.ToLowerInvariant […]

.

Read more

WP7, ApplicationBar, ImageUri and the Icon not showing up

Build Action: Content Copy to Output: Copy always (or ‘Copy if newer’, either should work) I spent a half an hour trying to figure out why my application bar was showing an “X” instead of the image I was putting in IconUri. When first adding images the properties default to: Build Action: Resource Copy to […]

.

Read more

Programming for Maintenance

Code Complete defines Maintainability as “The ease with which you can modify a software system to change or add capabilities, improve performance, or correct defects.” I’ve been thinking for awhile now about this post and I’ve been unsure of exactly what needs to be here.  I know I’ve done a lot of maintenance work.  It’s […]

.

Read more
FormatException

928 East Plymouth Drive Asbury Park, NJ 07712