WF4.0中的变量(variables)和参数(arguments)的区别

来源:互联网 发布:微信小店上传商品软件 编辑:程序博客网 时间:2024/06/10 19:17

WF4.0中的变量(variables)和参数(arguments)的区别

学习.net中的workflow时被里面的变量和参数迷惑住了,今天看了本书《Beginning WF Windows Workflow in .NET 4.0》,里面的一段换讲的很通俗易懂。

原文拿来

If you think of your workflow as a class, variables are the class members. You can use them to store data that must be shared between activities. You can define the scope of a variable—either the entire workflow or just a specific activity (and its children). Arguments are similar to variables, but they are intended for passing data in or out of the workflow. You can think of them as method parameters.

译文(水平有限,仅供参考)

把工作流想象成一个类,变量variables就是类成员,你可以拿变量来存储数据以便在不同的活动中共享。你可以定义变量的作用范围,这个范围可以是整个工作流也可以是特指的一个活动(当然这个活动的子孙都可以访问这个变量)。而参数arguments虽然和变量有点相似,但是他更倾向于工作流对外的数据传入和传出,你可以吧参数想象成“工作流类”方法的参数。


0 0