Say you want to use a variable as delay duration instead of hardcoding the time span (ie. 00:00:05), how do you convert a string variable into a proper duration variable?
Duration field accepts values with data type TimeSpan.
To convert a String to TimeSpan, use…
TimeSpan.FromSeconds(Integer.Parse(delay))
…where delay is a string variable containing the delay duration in seconds. In this example, it’s 10 seconds.
That’s it! Hope this helps!
Leave a Reply