 | Singleton Design Pattern |
| namespace Arindam
| | 1:{
| | 2: public class ETGSingleton
| | 3: {
| | 4: private static ETGSingleton _instance;
| | 5: private int counter =0;
| | 6: private ETGSingleton()
| | 7: {
| | 8: //
| | 9: // TODO: Add constructor logic here
| | 10: //
| | 11:
| | 12:
| | 13: }
| | 14:
| | 15: public static ETGSingleton Instance
| | 16: {
| | 17: get
| | 18: {
| | 19: if (_instance == null)
| | 20: _instance = new ETGSingleton();
| | 21: return _instance;
| | 22: }
| | 23: }
| | 24: public int getCounter()
| | 25: {
| | 26: return counter++;
| | 27: }
| | 28: }
| | 29:}
| | 30: |
|