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

Development for iPhone and Android with Mono

Update 2024-02-17: It’s kind of funny rereading this considering lately I’ve been doing a bunch of Maui dev. Okay, for the first time ever I’m a bit jealous of iPhone users.(See below)  Novel (the sponsor of Mono) has released the MonoTouch, a C# and .NET development platform for the iPhone.  Granted it’s $400 for the […]

.

Read more

Self-referencing Bindings

Between keeping up with what’s coming for .Net 4.0 as well as the end of a large DOD contract I’ve been a bit busy (and no developer fatigue, just busy :)). But don’t fret loyal readers, more will be coming soon. Until then here is a bit of xaml for self-referencing bindings. As you can […]

.

Read more

Often Unused Operators: Curly Braces {}

Okay, I know you think I’ve seriously hit the crack pipe here. Curly Braces, as I’m sure we all know, are fundamental to programming in most languages. This is true no more so then here in C#. We use them for if, for, using, do, while, namespace scope, class scope, method scope and getters and […]

.

Read more

LINQ group by and GroupBy

I initially starting using LINQ as it was easy to order the objects in a list without having to write a Comparer. Just write your lambda expression and BOOM!, list sorted. I want to take this thought a step further, and as implied by the post title, do a group by. Starting, here is an […]

.

Read more
FormatException

928 East Plymouth Drive Asbury Park, NJ 07712