C# 我常用的单例模式
public class TestEditor
{
private static TestEditor instance;
private static readonly object syncRoot = new object();
public static TestEditor GetInstance()
{
if (instance == null)
{
lock (syncRoot)
{
if (instance == null)
{
instance = new TestEditor();
}
}
}
return instance;
}
}