Windows application settings
I have a windows 开发者_JAVA技巧app written in C# (.net 3.5), and have a Settings.settings file that holds the application's settings.
When I do something like this:
Properties.Settings.Default.HSLastSend = DateTime.Now;
Properties.Settings.Default.Save();
it gets saved and persisted when I restart the application, however the Settings.settings file still has the original value. I can't seem to find where this new value is stored. I would have expected the Settings.settings file to have the new value when I went into it.
Is this a problem or normal?
Cheers in advance,
Stu
Setting.settings provide default values for the application, instead changed one, is saved in your binary file resources. You can prove it by loading your application after save changed settings, and you will get you changed value, even if Settings file has still "old" one.
EDIT
Just note that Properties.Settings.Default.
On XP machine it should be at:
C:\Documents and Settings\"YourMachineUserName"\Application Data\
Regards.
This is normal the settings file stores static values only and is designed for storing runtime application settings in a centralized place dynamic values such as DateTime.Now cannot be stored in this manner if you want the current DateTime why not call it in your code
精彩评论