Singleton Basics

The lifetime of a typical singleton object is not tied to the client. Consider .NET Remoting, for instance. When a client makes a call, the .NET Remoting service provides a thread from its pool, which then accesses the object. Multiple clients can access the same object on multiple different threads if they make concurrent calls.

If the singleton object is stateless (in other words, it doesn’t provide any class properties or member variables), there’s really nothing to worry about. Any variables created in a method body are local to the current call. In this case, a singleton object performs like a single-call object. In fact, contrary to what you might expect, a singleton object used in this way might even perform better because ...

Get Microsoft® .NET Distributed Applications: Integrating XML Web Services and .NET Remoting now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.