I added a settings file in my service application developed by C# in VS2008. In the designer of settings file, i inserted new datetime variable with user scope
and entered default value for that datetime variable. For instance, suppose that the name of this variable is MyDate
and its value is "2013-01-08
".
When i run my service application, i get the value of MyDate
correctly with the following code line:
Datetime value = app.Default.MyDate; // app is the name of the settings file
After that i set MyDate
to "2013-01-08 14:00:00
" with the following line of code:
app.Default.MyDate = DateTime.Now; // Suppose Now is 2013-01-08 14:00:00 at that time.
app.Default.Save();
Everything is OK until now. MyDate
parameter is set to what i want. However, i can not see the new value in app.config
file. When i open the config file in Debug folder, i only see that:
<setting name="MyDate" serializeAs="String">
<value>2013-01-08</value>
</setting>
And surprisingly, When i rerun the application, MyDate
parameter is seem to be "2013-01-08 14:00:00
" insead of "2013-01-08
"! I looked every config file in Debug folder and project folder but i couldn't find any value with "2013-01-08 14:00:00
". But MyDate
parameter is set to this value on startup.
I want to know where the value of MyDate variable is stored? Which file should i look for?
SOLUTION EDIT: I decided not to use settings file. I will use app.config file insead of settings file inorder to store my application parameters. app.config is not type-safe but it is easier to edit parameters infile. On the other hand, settings file is like a closed box that you can not find the file which it stores the parameter values.