I want to implement the most flexible string format for a TimeSpan object. Suppose you've this code:
string format = ".................";
TimeSpan ts = TimeSpan.FromSeconds(7200);
Debug.WriteLine(ts.ToString(format));
I want to specify a parameter (in app.config of my console application?) that contains a string format to switch different output format without touching the C# code. For example: 7200sec (outputs only the total seconds) 2h 00min 00sec (outputs the TimeSpan in a friendly manner) 120 min (outputs only the total minutes) and so on.
I don't want to adapt my code for each case.