0
comment
comment
on 10/19/2010 2:53 PM
In F#, class constructors can be declared in several different ways. To declare a non-static class, one usually defines a primary constructor, plus zero or more additional constructors. To declare a static class, one usually defines a module.
Using a Primary Constructor
In F#, it is possible to create a thread-safe singleton with just three lines of code:
/// A public thread-safe singleton class in F#,
/// using a private primary constructor.
type Singleton private() =
static let instance = Singleton()[...]