Delay.Duration 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
public:
property System::Activities::InArgument<TimeSpan> ^ Duration { System::Activities::InArgument<TimeSpan> ^ get(); void set(System::Activities::InArgument<TimeSpan> ^ value); };
[System.Activities.RequiredArgument]
public System.Activities.InArgument<TimeSpan> Duration { get; set; }
[<System.Activities.RequiredArgument>]
member this.Duration : System.Activities.InArgument<TimeSpan> with get, set
Public Property Duration As InArgument(Of TimeSpan)
属性值
计时器持续时间。
- 属性
示例
下面的代码示例演示如何在 Delay 活动中使用 Duration。 此示例摘自 使用选取活动 示例。
static Activity CreateWF()
{
Variable<string> name = new Variable<string>();
Sequence body = new Sequence
{
Variables = { name },
Activities =
{
new WriteLine { Text = "What is your name? (You have 5 seconds to answer)" },
new Pick
{
Branches =
{
new PickBranch
{
Trigger = new ReadString
{
Result = name,
BookmarkName = bookmarkName
},
Action = new WriteLine
{
Text = new InArgument<string>(env => "Hello " + name.Get(env))
}
},
new PickBranch
{
Trigger = new Delay
{
Duration = TimeSpan.FromSeconds(5)
},
Action = new WriteLine
{
Text = "Time is up."
}
}
}
}
}
};
return body;
}