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
Which template must you provide, in order to display data in a Repeater control? ItemTemplate.To display data in the ItemTemplate, declare one or more Web server controls and s

I need Simple upgrades for ASP.NET site I have an existing web solution, we need a new page for creating additional features. The current website is done in C#.NET and ASP.NET.

What is difference between SITP and UTP in testing? The Unit Test Plan (UTP) are completed at smallest unit level or stand alone mode. For example you have Customer and invoici

TFS - SpiraTeam synchronization plugin. Project Description: We would like you to develop the subsequent requirements in one plug-in already in production. The plug-in was de

Briefly explain how server form post-back works ?  Post Back: The process in which a Web page sends data back to the similar page on the server. View State : View State i

Describe the rules and regulations that must be followed whereas creating a well-formed XML document. The following are the rules and regulations that are essential to follow w

I need to create the subsequent iOS App/ iPhone (to be followed by Android & other platforms). Version 1.0--Users can: --Find events based on proximity/zipcode*/ location

cookieless="false" timeout="20" /> Above is sample session state mode specified for SQL SERVER.

Webpage builder windows application + source code + installer + user friendly interface. Project Description: Website Builder As its name suggests, the site builder should

Duplicate a Website I need a customer management site Please help me out and what I need to get. I need all charteristics of above mentioned site a) Effects b) Mobil