Thursday, February 16, 2006


Tutorial 1 : Singleton isn't guaranteed process-wide

A static/Shared field belongs to the class and is not part of any instance. Typically, when you see a static/Shared field, you know that no matter how many instances of the class exist, there is one and only one occurrence of this field. Often a static/Shared field is used to limit the number of instances of an objectthe concept of Singleton
A singleton takes measures to make sure that no more than one instance of its type can be created in an application. One way to do this is to make the constructor of the class protected or private, and to provide a static/Shared method to fetch the object
But let remember
A class's static/Shared fields are unique only in the AppDomain where the class is loaded. Each new AppDomain created in your application produces a new copy of them.

Comments: Post a Comment

Links to this post:

Create a Link

<< Home

This page is powered by Blogger. Isn't yours?