Archive for January, 2010

Immutable data structures in C#

Immutable data structures are well known in the functional domain but they are not that common in imperative languages like C#. A good thing about immutable objects in general is that many threads may access them in parallel (without using any locks). This is possible since they never change and thus no raise conditions can occur. As an excercise, I sat down and implemented three different immutable data structures in C#; a stack, a list and a graph. You may download the source code here.

Categories: Uncategorized