Noda Time
ToDuration Method
NamespacesNodaTimePeriodToDuration()()()()

[This is preliminary documentation and is subject to change.]

For periods that do not contain a non-zero number of years or months, returns a duration for this period assuming a standard 7-day week, 24-hour day, 60-minute hour etc.
Declaration Syntax
C#Visual BasicVisual C++
public Duration ToDuration()
Public Function ToDuration As Duration
public:
Duration ToDuration()
Return Value
The duration of the period.
Exceptions
ExceptionCondition
InvalidOperationExceptionThe month or year property in the period is non-zero.
OverflowExceptionThe period doesn't have years or months, but the calculation overflows the bounds of Duration. In some cases this may occur even though the theoretical result would be valid due to balancing positive and negative values, but for simplicity there is no attempt to work around this - in realistic periods, it shouldn't be a problem.

Assembly: NodaTime (Module: NodaTime.dll) Version: 1.2.0.0 (1.2.0)