Lazy instantiation one-liner of instance fields with the coalesce operator

13 May 2008 It is hardly worth blogging, but… Did you know that the return value of an assignment is the assignment? i.e. class Person { public string Name; } ... Person p; Console.WriteLine((p = new Person()).Name); And did you know there is a coalesce operator since .NET 2.0 that will return the...

WPF + INotifyPropertyChanged Proxy = Epic Fail!

08 May 2008 It seemed a straightforward thing to do. Sending property changed events when a property is changed is repetitive boilerplate code that can be factored out into an aspect of your system’s behaviour. This can be done with a proxy generator library like the Castle’s **DynamicProxy2 **(See my first attempts playing...

Is it alright to send messages to null references?

04 May 2008 This is a non-question, you may say, and even at the end of this post you will notice that it is still true that you cannot call anything on a null reference. But let me explain… Foundation for this post are the following blog entries… Raising events using extension methods...

Spring.AOP, Castle.DynamicProxy2 - first glance from an outsider

30 Apr 2008 The other day I got a presentation on Spring.NET and that it brings along quite a bit of aspect oriented Zen. My weapon of choice lately: Castle Windsor. Part of the project is the Castle.DynamicProxy2 (what a name!). It provides a functionality that is similar to the one you can...

Singletons are boring, hence factor out the concern

29 Apr 2008 dotnetkicks has an astonishing amount of entries related to “The Singleton”®… Regardless of whether Singletons are considered harmful or not, I could not resist but provide you with my own take on factoring out the need to get a Singleton which doesn’t feel like a Singleton at all. We can...