Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I write a date in app.config file? [closed]

I need to be able to define a date in app.config file. How do I do this and then retrieve it using c#?

like image 261
Nico A Avatar asked Jun 21 '12 14:06

Nico A


1 Answers

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);
like image 70
Darren Avatar answered Oct 03 '22 23:10

Darren