Implement singleton pattern in .net, DOT NET Programming

How can we implement singleton pattern in .NET ?

The Singleton pattern basically focuses on having one and only one instance of the object running. Lets take an e.g. a windows directory service which has many entries but you can only have single instance of it throughout the network.

There are three steps needed to implement singleton pattern in .NET which is shown below:-

1)   At First create your own class with the static members.

Public class ClsStaticClass

Private shared objCustomer as clsCustomer

End class

This ensures that there is actually one and only one Customer object throughout the project.

2) Second describe a private constructor to your class.

3) Finally give a static method to get the access to your singleton object.

Posted Date: 9/22/2012 6:08:54 AM | Location : United States







Related Discussions:- Implement singleton pattern in .net, Assignment Help, Ask Question on Implement singleton pattern in .net, Get Answer, Expert's Help, Implement singleton pattern in .net Discussions

Write discussion on Implement singleton pattern in .net
Your posts are moderated
Related Questions
What are the problems that can occur if you do not implement locking properly in SQL SERVER? The problems that occur if you do not implement locking properly in SQL SERVER is a

What are the differences between AJAX and JavaScript? The differences among AJAX and JavaScript are given as follows: AJAX sends request to the server and does not wait for

Looking to build FIFA coins selling and buying website Project Description: I would like a website made for FIFA 14 TEAM. What this website will do is having automatically bu

What's the difference between localization and globalization? Globalization: The Globalization is a process of developing a program core whose features and code design are no

Design the following interface and add code to the command buttons to achieve the following using case statement. I) find coursework to be calculated using the following formula:-0

how to write a postfix expression calculator program using c#

Question: (a) How do you implement the following in ASP.NET: (i) Server-side Comments (ii) Server-side Include Directives. (b) (i) Give two reasons why the IsPostBack

Sorting 2 Arrays & Merging into 1 - C# Program Hello, i didn't find the correct way to implement Array in my project. I am beginner for this language.  Please suggest me some

Calculating the Sum of Digits - C# Program Hi, Can any of you, tell me how can i calculate the sum of digits of a given number?

Inventory billing and Management application in .net Project Description: Digital Inventory management Main Features         Multi user User friendly windows based s