I need to be able to define a date in app.config file. How do I do this and then retrieve it using c#?
Store the value in the config file:
<appSettings>
<add key="DateKey" value="2012-06-21" />
</appSettings>
Then to retrieve the value you van use:
var value = ConfigurationSettings.AppSettings["DateKey"];
var appDate = DateTime.Parse(value);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With