Singleton class in oops is a facility that provide us an option to define a class to have single instance throughout the program lifetime, it also help us to have a global access point.
How to implement singleton class in c#:
How to implement singleton class in c#:
using System;public class Singlton{private static Singleton instance;private singleton(){}public static Singleton instance{get{if(instance ==null){instance =new Singleton();//Checks if the instance has already been created,//if yes will return the already created instance else,//will create a new instance of the Singleton Class.}return instance;}}}
No comments:
Post a Comment
Thank you for Commenting Will reply soon ......