//Class , Only one instance is created of Singleton class.
public class Singleton
{
public int x=0;
private static Singleton Instance;
private Singleton() { }
public static Singleton instance
{
get
{
if (Instance == null)
{
Instance = new Singleton();
}
return Instance;
}
}
}
//Page Load Check for Instance
Singleton s = Singleton.instance;
Singleton s1 = Singleton.instance;
Sunday, February 20, 2011
Subscribe to:
Posts (Atom)