TimeSpan vs Duration

After reading the MSDN pages for the Timespan structure and the Duration structure,
I must admit that I'm still not sure what the difference is between the two.

In addition, the Duration structure contains a Duration(TimeSpan) Ctor,
which makes them even more similar.

So can anyone tell me when each should be used?

Timespan structure:
https://msdn.microsoft.com/en-us/library/system.timespan.aspx

Duration structure:
https://msdn.microsoft.com/en-us/library/system.windows.duration.aspx

+6
source share
1 answer

You probably want to use TimeSpan .

TimeSpan is the general data structure in the System namespace. Duration is a specialized WPF animation framework. Description of Duration summarizes:

Represents the time during which Timeline is active.

If you want to do just that (specify the duration of the WPF animation timeline), use Duration . Otherwise, use TimeSpan .

+12
source

All Articles