Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Why I can not make my Connection String a const?
Message
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:
01349995
Vues:
26
This message has been marked as a message which has helped to the initial question of the thread.
Hi Naomi,

>What is better and why, the way I currently have it in util.cs or the way you showed?

Depends... A static property can make code slightly slower if you also have a static constructor and access it from an instance method. Static properties are also considered risks in stateless classes such as when writing code for the SQL Server CLR. On the other hand it saves memory since there's only one property. Without string interning there's also only one instance of the string. In a static class, though, you have to use a static property.
--
Christof
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform