Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Why I can not make my Connection String a const?
Message
 
 
À
23/09/2008 16:53:51
Timothy Bryan
Sharpline Consultants
Conroe, Texas, États-Unis
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Versions des environnements
Environment:
C# 3.0
OS:
Windows XP
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
01349894
Message ID:
01405546
Vues:
65
>A singleton is different pattern but it could be that if included within the class including a private constructor. The code I showed was basically a property in some other class using Lazy Instantiation. But the idea can be close. Here is an example of a singleton.
>
>
>public class RFIDReader
>{
>     #region Singleton
>     private static RFIDReader instance = null;
>     public static RFIDReader Instance
>     {
>          get
>          {
>               if(instance == null)
>                    instance = new RFIDReader();
>
>               return instance;
>          }
>     }
>
>     protected RFIDReader()
>     {
>          this.InitializeComponent();
>     }
>
>     #endregion Singleton
>}
>
Thanks again to everyone.
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform