Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Why I can not make my Connection String a const?
Message
 
 
To
23/09/2008 13:45:42
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Environment versions
Environment:
C# 3.0
OS:
Windows XP
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01349894
Message ID:
01349951
Views:
34
>>>>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
Previous
Reply
Map
View

Click here to load this message in the networking platform