Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Global Objects
Message
De
03/09/2007 15:05:33
 
 
À
03/09/2007 12:45:03
Timothy Bryan
Sharpline Consultants
Conroe, Texas, États-Unis
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Titre:
Versions des environnements
Environment:
C# 2.0
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
MS SQL Server
Divers
Thread ID:
01251812
Message ID:
01252027
Vues:
19
>John,
>
>Another part of your question mentioned Not wanting to instanitate the class every time you needed to access the settings data. There is a design pattern called the Singleton Design Pattern that addresses this issue also. Essentially the class itself can check to see if has already been instantiated before calling the constructor. I use a variation of what Rick mentioned where I have a settings class that uses the singelton design pattern. I instantiate the settings class from my main application object but can get a reference to it from anyother class as needed without creating another instance. Within this settings class all the settings properties are static and read from xml file or database or ?.
>Tim

More cool data.

Taking me a bit to research the difference between when to use singleton and when to use static classes, but I'm getting it slowly.

I have a number of cases where singleton may make sense for me, I will have to play with it some more.

Thanks
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform