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
Inventory billing and Management application in .net Project Description: Digital Inventory management Main Features         Multi user User friendly windows based s

Can a .NET web application consume Java web service? Yes Offcourse.Actually Webservices are independent  to language. It depends on WSDL and SOAP. so any one can develope the W

A Super-hero Sharepoint developer with great design skills Project Description: US: Our start-up company develops a very cool and innovative SharePoint related product with c

Assignment for inheritance based on c#

What are Assemblies? Assembly is a single deployable unit that have information about the implementation of classes, structures and interfaces. It also keeps the information ab

deploying a mysql vb offline desktop application in new system that doesnot have any server or database created

Explain collation sequence in sql server. The Collation sequences are the set of rules which determine how the data is sorted and compared. The Sorting rules can be defined wit

About us in a nutshell: We are a young start-up that trade a refreshing product in the field of enterprise software and develops with the latest technologies. We love to partner wi

What is XML DOM? The DOM stands for Document Object Model, which explains the logical formation of documents and provides the way to access and manipulate a document. It suppli

Demonstrating Boxing and Unboxing - C# Program Hi, Can any of you, tell me how to use boxing and Unboxing in c#?