April 2008
Intermediate to advanced
704 pages
17h 49m
English
Problem
You need to ensure that only a single instance of a type exists at any given time and that the single instance is accessible to all elements of your application.
Solution
Implement the type using the Singleton pattern.
How It Works
Of all the identified patterns, the Singleton pattern is perhaps the most widely known and commonly used. The purpose of the Singleton pattern is to ensure that only one instance of a type exists at a given time and to provide global access to the functionality of that single instance. You can implement the type using the Singleton pattern by doing the following:
Implement a Private Shared member within the type to hold a reference to the single instance of the type.
Read now
Unlock full access