Shorter Construction Syntax

Did you ever notice the redundancy that’s forced by C#’s syntax for invoking and defining constructors?

using System.Collections.Generic;

class Thing
Thing(int x, int y)
{ … }

public static void Main()
Thing a = new Thing(3,2);
Dictionary<string,double> b

Links and Page URIs that Resist Link Rot

The essential ideas of using permalinks to avoid link rot have been around much longer than since the term permalink came into common use. The term permalink appears to have originated around the year 2000, and was widely used only after that. Tim Berners-Lee wrote an
about the essential ideas in 1998, and […]

The “Structs Should Always be Immutable” Guideline

Sometimes one comes across the following guideline for C# structs:

All structs should be immutable.

The results of searching the web for justification for this are not very satisfying.

One argument sometimes advanced is that an immutable struct is usually simpler to understand than a mutable struct. This argument is true, but it also applies to classes, so […]

A non-Obvious Benefit of Replacing Boolean Arguments with Enumerations

When a method takes a boolean argument, it is sometimes better to restructure the method so that it takes an enumeration argument. In this article we show that the real benefit of this is not obvious and is often misunderstood.

Consider the following method and one of its clients:

void search(bool useCaseSensitiveSearch)
{ … }

void client()

Origin of the Name

People sometimes wonder about the origin of my domain name Here’s how I chose it.

Some time around when I left grad school, I realized that it was good to have one’s own domain instead of relying on a school or company or something else to store it.

I spent the better part of a day […]

C# 2.0: 3f.Equals(3) != 3.Equals(3f)

In C#, it is good practice to make the Equals method commute.  But even the Base Class Library fails to do this sometimes.  It’s possible to have a.Equals(b) != b.Equals(a) even with primitive types, e.g, when a is a Single (a float) and b is an Int32.