Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Why I can not make my Connection String a const?
Message
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:
01349995
Views:
25
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
Previous
Reply
Map
View

Click here to load this message in the networking platform