C# .Net 4.0
I'd like to know how I can have a class which can only be instantiated from one single place. An example:
I've got a Provider class. This class exposes a method called GetData. When GetData is called, the Provider will instanciate a Data class, populate and return it. The Data class cannot be instanciated by anybody different then the Provider, so the only way to access the data will be through the Provider. Once GetData is called and a caller has received the Data class instance, he should be able to access properties/methods of this class.
How can this be done? Is there a pattern for this sort of problem? A short sample would be highly appreciated. Thanks in advance!