Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Newbie question on C#
Message
 
General information
Forum:
ASP.NET
Category:
Other
Environment versions
Environment:
C# 2.0
Miscellaneous
Thread ID:
01532477
Message ID:
01532526
Views:
35
>>>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.
>>
>>You're aiming for a Public memvar and it's as bad an idea in .NET as it is in FoxPro. Pretty soon you've got a bunch of them polluting your environment. Just make the call when you need the value.
>
>I don't think that having public field is the same as public memvar in VFP. But I could be mistaken.

You're right, it's not the same thing.
Previous
Reply
Map
View

Click here to load this message in the networking platform