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 role of the DataSet object in ADO.NET? One of the major components of ADO.NET is the DataSet object, which always remains disconnected from the database and decreas

What are Windows services? Windows services, previously called as NT services, are applications that are installed on the system as system services. In other words, Windows ser


What is Six Sigma implementation? To attain Six Sigma is a team effort and cannot be attained individually. Driving the Six Sigma itself in an organization is vast project as i

What is the difference between the Clone() and Copy() methods of the DataSet class? The Clone() method copies only the structure of a DataSet. The copied structure having all t

create a table using class file

Project Description: We have a web based program prepared with .NET C# and Microsoft SQL Server. There are some reports needs to be created. Required Skills. - High Pro

Investment Equation - C# Program I didn't know the exact code for computing Investment Equation. Can anybody suggest me the correct way for my problem?

What is Multi-tasking? It is a feature of the modern operating system with which we can run multiple programs at the same time for example Word, Excel etc.

Manifest Assembly metadata is always stored in the Manifest. Manifest consists of all metadata required to do the following things: 1) Version of assembly 2) Security ident