Link: http://msdn.microsoft.com/en-us/library/ms998558.aspx

using System;

public sealed class Singleton
{
private static volatile Singleton instance;
private static object syncRoot = new Object();

private Singleton() {}

public static Singleton Instance
{
get
{
if (instance == null)
{
lock (syncRoot)
{
if (instance == null)
instance = new Singleton();
}
}

return instance;
}
}
}

相关文章:

  • 2021-12-12
  • 2022-01-06
  • 2022-12-23
  • 2021-10-16
  • 2022-01-01
  • 2021-12-12
  • 2021-07-08
  • 2022-12-23
猜你喜欢
  • 2021-09-15
  • 2022-02-26
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-16
相关资源
相似解决方案