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 is the Scope of public/private/friend/protected/protected friend? Scope of public/private/friend/protected/protected friend Visual Basic/Visual C# Public/public all

This assignment will have you create a simple static web page. It should look something like this: The colored boxes do not represent colors I want to see, make it look nic

The program is broke now but explains in text and printscreens the specific things i have to do to implement new bookies new sports and change settings for looking for arbs on two

I have a code in C# which uses Microsoft Solver Foundation to solve linear programming model. But the problem is the code is too long, there are too many variables and constraints,

What does a break statement do in the switch statement? The switch statement is a selection control statement that is used to handle many choices and transfer control to the ca

PhotoHandler add-on to display file names Project Description: I want a website with a photo gallery using PhotoHandler. I need the code added/ modified to display the image

Requirements: 1.  Complete the following two exercises by developing working csharp projects. 2.  Write a report to explain csharp code written in the projects. 3.  Submi

Name the two properties of the GridView control that have to be specified to turn on sorting and paging. The properties of the GridView control that require to be specified to

Project Description: We require an expert developer to work on several projects for our company. You will be managed by our senior developer. Required - MUST be proficient in

Project Description: Take a CSV of Canadian street addresses. For every address, translate the address into a GPS coordinate. Use the GPS coordinate to test whether or not the a