Während Stackoverflow Surfen stieß ich auf die folgende Antwort:Warum die Box hier?
https://stackoverflow.com/a/3817367/162694
// ... removed unneeded code
/// This type is intended for private use within Singleton only.
type private SyncRoot = class end
type Singleton =
[<DefaultValue>]
static val mutable private instance: Singleton
private new() = { }
static member Instance =
lock typeof<SyncRoot> (fun() ->
// vvv
if box Singleton.instance = null then
// ^^^
Singleton.instance <- Singleton())
Singleton.instance
Kann jemand erarbeiten, warum die hier box
benötigt?