>>>Hi,
>>>
>>>I am getting back to my ASP.NET application and relearning C#.
>>>
>>>I have a class defined as PUBLIC SEALED CLASS (I think it is called static class, right?). In this class I have bunch of methods where some of them get value(s) from WEB.CONFIG using the following syntax:
>>>
>>>
>>>string MyString = @ConfiguartionManager.AppSettings["MySetting"];
>>>
>>>
>>>My question is, would I be better off (app runing faster) if I create a property (or a field?) in this class (correct syntax?) and store the value there (when they are retrieved the first time). And then, instead of "getting" the value from WEB.CONFIG, the value would be always available in the property or a field.
>>>
>>>Does the above make sense? TIA.
>>
>>Sure. Create the connectionstring as the public property of the class for easy access.
>
>Thank you.
Dmitry,
(1) A sealed class means you can not inherit from it
http://msdn.microsoft.com/en-us/library/88c54tsw.aspx(2) If the property does not change, add it as a public static readonly property
public static readonly string MyString = ConfiguartionManager.AppSettings["MySetting"];
Gregory