.net

Emulating F#'s 'with' Construct in C# using Parameter Object Design Pattern

This article introduces a way to emulate F#'s 'with' construct in C#. In particular, it is shown how a factory method can be implemented which creates a new object based on a provided template object and optional additional values (replacing values of the template object) in a type-safe way. While the presented solution doesn't use new C# 4.0 language features, using them for this task is also considered and discussed.

Syndicate content