标准Singleton设计模式,多线程下
public class SessionAssistant {
private static volatile SessionAssistant instance;
private static object syncRoot = new Object();
private SessionAssistant()
{
}
public static SessionAssistant Instance
{
get
{
if ( instance == null )
{
lock ( syncRoot )
{
if ( instance == null )
{
instance = new SessionAssistant();
}
}
}
return instance;
}
}
}