C#单例示例:
代码
public class Singleton
{
private static Singleton instance;
private Singleton()
{
}
public static Singleton Instance
{
get
{
if (null == instance)
{
instance = new Singleton();
}
return instance;
}
}
public void Test()
{
// do somthing
}
}