Singleton: Difference between revisions

Content added Content deleted
m (→‎{{header|PureBasic}}: update with alternative version)
m (→‎{{header|C#}}: Formating)
Line 272: Line 272:
}</lang>
}</lang>


=={{header|C#}}==
=={{header|C sharp|C#}}==
A thread safe singleton implementation.
A thread safe singleton implementation.
To make it non-thread safe remove lockObject and the lock() statement.
To make it non-thread safe remove lockObject and the lock() statement.


<lang csharp>
<lang csharp>// Usage: Singleton.Instance.SomeMethod()
// Usage: Singleton.Instance.SomeMethod()
class Singleton
class Singleton
{
{
Line 296: Line 295:
}
}
// The rest of the methods
// The rest of the methods
}</lang>
}
</lang>


=={{header|Erlang}}==
=={{header|Erlang}}==