F# - Singleton pattern

by Gregor Uhlenheuer on May 6, 2012

A few days ago I wondered how to implement the Singleton pattern in F#. After a few failed attempts I came up with the following:

The point I had the most trouble with was the correct definition of a static let binding. So in order to make a let binding static in a type definition just put a static in front of it - that’s all.

This post is tagged with programming, f# and .net