Sample implementation in C# (.NET 2.0+):
public class MySingleton
{
private readonly object _lock = new object();
private MySingleton _singleton;
public static MySingleton GetInstance()
{
get
{
if (_singleton == null)
{
lock (_lock)
{
if (_singleton == null)
_singleton = new MySingleton();
}
}
return _singleton;
}
}
}