Method hiding or overriding – or the difference between new and virtual

When developing applications it is very important to understand the difference between method hiding and method overriding. By default C# methods are non-virtual. If you are a Java developer this may come as a surprise. This means that in C# if you want a method to be extensible you must explicitly declare it as virtual …

Developing with SQL Server 2008, deploying on SQL Server 2005

I received the following by email today: Hi Colin! I found your blog after googling for a bit about SQL Server. I had a question for you… As someone fairly new to .NET development, would it be easier to stick with SQL Server 2005 for now, or just install SQL Server 2008 express? I ask …

The try-catch-return-false-throw-catch-return-false-throw-fail anti-pattern

I recently came across a wonderful anti-pattern. Well, anti-patterns are not wonderful, but the mind just boggles at the sheer bloody lunacy of this particular anti-pattern. I’m not going to show you the original code, but I’ll show a general representation of what it did: private void DoStuff() { if (!C()) throw new Exception(“The widget …

Visual Studio 2008 SP1

Visual Studio 2008 SP1 is here and can be downloaded. Details of the downloads are here, and information on what SP1 brings is here. The big items for me are the Entity Framework and the performance improvements in LINQ. However, before you go rushing off to install SP1 there are some caveats. If you’ve been …

Mixins in .NET (again)

A while ago I wrote about Mixins in C# 3.0, at the time I was saying that you can get some of the functionality, but not all, from some of the new language features in C#3.0. The solution is a bit of a fudge because the language doesn’t support the concept. I’ve been looking at …

Crazy Extension Methods Redux (with Oxygene)

Back in April I blogged about a crazy thing you can do with extension methods in C#3.0. At the time I was adamant that it was a bad idea. I still think it is a bad idea, however, my thoughts have evolved a little since then and I have, possibly a solution to my hesitance …

Tip of the Day #8 (string performance)

Concatenating strings in .NET can be very easy. There is the overloaded + operator that makes stringA + stringB + stringC statements very easy to write. But, it isn’t very performant. The reason is that strings are immutable, and concatenating strings in this way causes lots of short-lived objects to be created and thrown away, …

SQL Server / Visual Studio Install Order

Yesterday I paved my laptop in order to upgrade to Windows Vista. I’ve now started to reinstall everything from scratch again. However, one thing that didn’t work out was the installation of SQL Server 2005. No matter what I tried I could not seem to get it to install the SQL Server Management Studio – …

Installing SQL Server 2005 on Vista

Perhaps this is not so much an issue with installing SQL Server 2005 on Vista, but of the way I install SQL Server 2005 on Vista, or even more accurately install it on my laptop on Vista. A SQL Server will expect to run constantly on the machine that it is installed on. However, not …

What's New in Visual Studio 2008 Service Pack 1

Finally, Microsoft have a date for an event in Scotland. It is on 16th of October in their new offices in Waverley Gate, Edinburgh. Here are the details: [Register for the event here] 16 October 2008 13:30 – 16:15 Welcome Time: 13:00 Microsoft Scotland Waverley Gate 2-4 Waterloo Place Edinburgh EH1 3EG Event Overview Timings …