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 13:45:42
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:
01349951
Vues:
35
>>>>Thanks again.
>>>
>>>
>>>Make it static then
>>>
>>>static private string xxx = "yyyy";
>>>
>>
>>Thanks, that seems to compile. BTW, I don't understand a problem with VS 2005 SP1. It says build succeeded and then shows 100+ errors which are not really errors. Somehow it often can not resolve references properly and even often shows keywords highlighted as errors.
>
>
>If you want to make it readonly
>
>Readonly fields can be initialized (1) in the declaration and (2) in the constructor
>A readonly field can be considered as a runtime constant
>
>
>static class ClassName
>{
>     static readonly string xxx = "yyy";
>     static readonly string zzz = AnotherClass.Method();
>
>
>}
>
I got very interesting and strange problem which I'm not sure is related to my change or not. I haven't tested this app today before.
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