Using a TimeSpan as a Timer Interval
问题 How can I use the value of a TimeSpan as the interval for a Timer ? 回答1: Get the total milliseconds from the TimeSpan to use in the constructor for Timer: var timer = new Timer(someTimeSpanObject.TotalMilliseconds); 回答2: From: http://msdn.microsoft.com/en-us/library/system.timespan.totalmilliseconds.aspx TimeSpan interval = new TimeSpan(1, 15, 42, 45, 750); Console.WriteLine("Value of TimeSpan: {0}", interval); Console.WriteLine("{0:N5} seconds, as follows:", interval.TotalMilliSeconds); You