Farewell Visitor

The Visitor design pattern was first documented in 1995 by the Gang of Four. It’s a workaround for the fact that most strongly typed object oriented languages only support single dispatch, even when sometimes double dispatch is required. With C# 4, we no longer need this workaround. We now have some... [More]

Lambda Curry in F#

Bart De Smet commented on my post about Lambda Curry in C#, saying (amongst other things) that F# supports currying out of the box. That’s true, and it’s a nice feature of the language. However, it is a mechanical operation, almost identical to what the following C# extension method does: public&#... [More]

Safe disposal of WCF proxies

The issue has been known for a long time: you cannot safely dispose a WCF proxy that inherits from ClientBase<T> with a using statement, because the dispose method may throw.  For more information, see http://www.google.com/search?q=wcf+proxy+dispose. However, I’ve always found most solu... [More]

Lambda Curry

Note: if you’re looking for lamb curry, you came to the wrong place. This post is about C# programming techniques. Currying a function is a technique named after Haskell Curry, to transform a function with multiple parameters into a series of functions having one parameter each. The technique is im... [More]

Static Reflection in .NET, part 2

A few weeks ago, I talked about static reflection and its advantages. You’ll remember that the main advantages, compared to the normal reflection API’s, are the compile time checking of parameters and IntelliSense support. How does it compare at other levels, performance for example? Before we dive... [More]

String.Trim() fixed in .NET 4.0

A long time ago, I wrote a blog post about the problems with String.Trim(). I’m happy to see that all three issues have been addressed in the .NET Framework 4.0. To start with, Trim() will now be consistent with Char.IsWhiteSpace(). Theoretically, this is a breaking change, but I don’t expect many ... [More]

Static Reflection in .NET

LINQ expressions have proven to be extremely versatile, popping up in all sorts of areas. “Static Reflection” seem to be the latest hype. But what is static reflection anyway, and why is it good or why is it bad? Reflection is used to obtain information about the code you are executing, and to use ... [More]