After reading the MSDN pages for the Timespan
struct and the Duration
struct,
I must admit that I am still not sure what is the difference between them.
Furthermore, the Duration struct contains a Duration(TimeSpan)
Ctor,
which makes them even more similar.
So can anyone please tell me when each of them should be used?
Timespan struct:
https://msdn.microsoft.com/en-us/library/system.timespan.aspx
Duration struct:
https://msdn.microsoft.com/en-us/library/system.windows.duration.aspx
You probably want to use TimeSpan
.
TimeSpan
is a generic data structure in the System
namespace. Duration
is a specialized structure for WPF animations. The description of Duration sums it up pretty well:
Represents the duration of time that a Timeline is active.
If you want to do exactly that (define the duration of a WPF animation timeline), use Duration
. Otherwise, use TimeSpan
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With