Appointment.Duration 属性

定义

获取或设置表示约会持续时间的时间跨度。 Duration 的类型为 TimeSpan ,必须为非负值。

public:
 property TimeSpan Duration { TimeSpan get(); void set(TimeSpan value); };
TimeSpan Duration();

void Duration(TimeSpan value);
public System.TimeSpan Duration { get; set; }
var timeSpan = appointment.duration;
appointment.duration = timeSpan;
Public Property Duration As TimeSpan

属性值

表示约会持续时间的时间跨度。 持续时间不能为负值。

Windows 要求

应用功能
appointmentsSystem

注解

此属性使用时间跨度值,该值的表示方式因编程语言而异。

  • 在 JavaScript 中,使用表示时间间隔的 Number 设置 Duration 值。 TimeSpan 值的每个单位表示 1 毫秒。 例如,此代码将 Duration 值设置为 60 分钟 (一小时) 。 '''javascript appointment.duration = (60 * 60 * 1000) ;1 小时(以 1 毫秒为单位)


+ In Visual C++ component extensions (C++/CX), use a <xref:Windows.Foundation.TimeSpan?text=TimeSpan> structure value with a **Duration** value. In Visual C++ component extensions (C++/CX), each unit for a **Duration** value represents 100 nanoseconds.
+ In C# or Microsoft Visual Basic, you use a [System.TimeSpan](/dotnet/api/system.timespan?view=dotnet-uwp-10.0&preserve-view=true) value. You can use utility API of [System.TimeSpan](/dotnet/api/system.timespan?view=dotnet-uwp-10.0&preserve-view=true) such as [FromSeconds](/dotnet/api/system.timespan.fromseconds?view=dotnet-uwp-10.0&preserve-view=true) to generate a [System.TimeSpan](/dotnet/api/system.timespan?view=dotnet-uwp-10.0&preserve-view=true) and set the value.




> [!NOTE]
> In JavaScript, <xref:Windows.Foundation.TimeSpan?text=TimeSpan> is accessed as a value, not as an object. For example, use `var a = 10000`, not `var a = { duration: 10000 }`. Also, in JavaScript, <xref:Windows.Foundation.TimeSpan?text=TimeSpan> is treated as the number of millisecond intervals, not the number of 100-nanosecond intervals so you can lose precision when you port <xref:Windows.Foundation.TimeSpan?text=TimeSpan> values between languages.

适用于