the gumby way to do what you want would be like
{
string path_abc = "";
path_abc = ConfigurationManager.AppSettings.Get("abc");
DateTime dt_abc = File.GetLastAccessTime(path_abc);
Console.WriteLine("the last access time for {0} is {1}", path_abc, dt_abc);
string path_def = "";
path_def = ConfigurationManager.AppSettings.Get("def");
DateTime dt_def = File.GetLastAccessTime(path_def);
Console.WriteLine("the last access time for {0} is {1}", path_def, dt_def);
}
catch (Exception e)
{
Console.WriteLine("The process failed: {0}", e.ToString());
}
Thread.Sleep(5000);
but thats a repeat .. boring ... all this
Quote:
{
string path = "";
path = ConfigurationManager.AppSettings.Get("abc");
DateTime dt = File.GetLastAccessTime(path);
Console.WriteLine("the last time {0}", dt);
}
catch (Exception e)
{
Console.WriteLine("The process failed: {0}", e.ToString());
}
should be ripped out and put in a public static function that returns a DateTime and takes the name of the 'key' in the config file as a string to work with, with appropriate error handling etc - you'd have to decide what to return if the path didnt exist for example