本文整理汇总了C#中System.Activities.OutArgument<T>类的典型用法代码示例。如果您正苦于以下问题:C# OutArgument<T>类的具体用法?C# OutArgument<T>怎么用?C# OutArgument<T>使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OutArgument<T>类属于System.Activities命名空间,在下文中一共展示了OutArgument<T>类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1:
Sequence workflow = new Sequence
{
Variables = { mealExpense, result },
Activities =
{
new Assign<Expense>
{
Value = new InArgument<Expense>( (e) => new Meal { Amount = 50, Location = "Redmond", Vendor = "KFC" }),
To = new OutArgument<Expense>(mealExpense)
},
new WriteLine
{
Text = new InArgument<string>("Hello")
},
approveExpense,
new ReceiveReply
{
Request = approveExpense,
Content = ReceiveContent.Create(new OutArgument<bool>(result))
},
new If
{
Condition = new InArgument<bool> (result),
Then =
new WriteLine
{
Text = new InArgument<string>("Expense Approved")
},
Else =
new WriteLine
{
Text = new InArgument<string>("Expense Cannot be Approved")
},
},
}
};
开发者ID:.NET开发者,项目名称:System.Activities,代码行数:37,代码来源:OutArgument
示例2: Divide
int dividend = 500;
int divisor = 36;
Dictionary<string, object> arguments = new Dictionary<string, object>();
arguments.Add("Dividend", dividend);
arguments.Add("Divisor", divisor);
IDictionary<string, object> outputs =
WorkflowInvoker.Invoke(new Divide(), arguments);
Console.WriteLine("{0} / {1} = {2} Remainder {3}",
dividend, divisor, outputs["Result"], outputs["Remainder"]);
开发者ID:.NET开发者,项目名称:System.Activities,代码行数:12,代码来源:OutArgument
示例3: Execute
public sealed class Divide : CodeActivity
{
[RequiredArgument]
public InArgument<int> Dividend { get; set; }
[RequiredArgument]
public InArgument<int> Divisor { get; set; }
public OutArgument<int> Remainder { get; set; }
public OutArgument<int> Result { get; set; }
protected override void Execute(CodeActivityContext context)
{
int quotient = Dividend.Get(context) / Divisor.Get(context);
int remainder = Dividend.Get(context) % Divisor.Get(context);
Result.Set(context, quotient);
Remainder.Set(context, remainder);
}
}
开发者ID:.NET开发者,项目名称:System.Activities,代码行数:20,代码来源:OutArgument
注:本文中的System.Activities.OutArgument<T>类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论