Version

Duration Property

Returns or sets the amount of time spanned by the task.
Syntax
'Declaration
 
Public Property Duration As TimeSpan
public TimeSpan Duration {get; set;}
Exceptions
ExceptionDescription
SummaryTaskExceptionThrown when the property value is changed for a summary task.
Remarks

When a task is a summary, the Duration cannot be changed, as it is then defined by the range of time spanned by each subtask. Attempting to change the value of the Duration property when the task is a summary will cause an exception to be thrown.

The Duration property cannot be changed for a milestone task either, since milestones are of zero duration. A milestone task always returns TimeSpan.Zero from this property. Attempting to change the value of the Duration property when the task is a milestone will cause an exception to be thrown.

Setting the Duration property changes the value of the EndDateTime property.

When the Milestone property returns true, the value of this property is displayed in the task grid, but the effective duration resolves to TimeSpan.Zero, as milestones represent an instant in time rather than a span of time.

Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also