InOutArgument<T> 类
定义
表示数据流入和流出活动的绑定终端。A binding terminal that represents the flow of data into and out of an activity.
generic <typename T>
public ref class InOutArgument sealed : System::Activities::InOutArgument
[System.ComponentModel.TypeConverter(typeof(System.Activities.XamlIntegration.InOutArgumentConverter))]
[System.Windows.Markup.ContentProperty("Expression")]
public sealed class InOutArgument<T> : System.Activities.InOutArgument
[<System.ComponentModel.TypeConverter(typeof(System.Activities.XamlIntegration.InOutArgumentConverter))>]
[<System.Windows.Markup.ContentProperty("Expression")>]
type InOutArgument<'T> = class
inherit InOutArgument
Public NotInheritable Class InOutArgument(Of T)
Inherits InOutArgument
类型参数
- T
InOutArgument<T> 的数据类型。The data type of the InOutArgument<T>.
- 继承
- 属性
注解
在本例中,一个自定义的 Square 活动具有一个名为 InOutArgument<T> 的 Int32 类型的 N1。In this example, a custom Square activity has an InOutArgument<T> of type Int32 named N1. 此自变量不仅可用于接收要运算的值,还可用于发回运算结果。This argument is used to receive the value to be operated on and is also used to pass the result of the operation back out.
class Square : CodeActivity
{
public Square() : base() { }
public InOutArgument<int> N1
{
get;
set;
}
protected override void Execute(CodeActivityContext context)
{
context.SetValue<int>(N1, N1.Get(context) * N1.Get(context));
}
}
在下例中,Square 活动承载于工作流中。In the following example, the Square activity is hosted in a workflow. 当一个值传递到活动时,结果随后会由 WriteLine 活动显示在控制台窗口中。A value is passed into the activity and the result is then displayed to the console window by a WriteLine activity.
Variable<int> n1 = new Variable<int>() { Default = 25 };
Activity activity1 = new Sequence()
{
Variables =
{
n1
},
Activities =
{
new Square()
{
N1 = new InOutArgument<int>(n1)
},
new WriteLine()
{
Text = new InArgument<string>(ctx => "Squared result: " + n1.Get(ctx))
}
}
};
WorkflowInvoker.Invoke(activity1);
构造函数
| InOutArgument<T>() |
使用默认值初始化 InOutArgument<T> 类的新实例。Initializes a new instance of the InOutArgument<T> class using default values. |
| InOutArgument<T>(Activity<Location<T>>) |
使用指定的 InOutArgument<T> 初始化 Activity<TResult> 类的新实例。Initializes a new instance of the InOutArgument<T> class using the specified Activity<TResult>. |
| InOutArgument<T>(Expression<Func<ActivityContext,T>>) |
使用指定的表达式初始化 InOutArgument<T> 类的新实例。Initializes a new instance of the InOutArgument<T> class using the specified expression. |
| InOutArgument<T>(Variable) |
使用指定的 InOutArgument<T> 初始化 Variable 类的新实例。Initializes a new instance of the InOutArgument<T> class using the specified Variable. |
| InOutArgument<T>(Variable<T>) |
使用指定的 InOutArgument<T> 初始化 Variable<T> 类的新实例。Initializes a new instance of the InOutArgument<T> class using the specified Variable<T>. |
字段
| ResultValue |
表示“Result”的常量值,该值对应于表达式基类 ActivityWithResult 中类型为 OutArgument 的 Result 属性的名称。Represents the constant value of "Result", which corresponds to the name of the Result property of type OutArgument in the expression base class ActivityWithResult. (继承自 Argument) |
属性
| ArgumentType |
获取数据绑定到此 Argument 的数据类型。Gets the data type for the data bound to this Argument. (继承自 Argument) |
| Direction |
获取 ArgumentDirection,该值指定 Argument 是表示数据流入活动、流出活动还是流入和流出活动。Gets an ArgumentDirection that specifies whether the Argument represents the flow of data into an activity, out of an activity, or both into and out of an activity. (继承自 Argument) |
| EvaluationOrder |
获取或设置一个从零开始的值,该值指定自变量的计算顺序。Gets or sets a zero-based value that specifies the order in which the argument is evaluated. (继承自 Argument) |
| Expression |
获取一个表示此 Activity<TResult> 的值的 InOutArgument<T>。Gets an Activity<TResult> that represents the value of this InOutArgument<T>. |
方法
| Equals(Object) |
确定指定对象是否等于当前对象。Determines whether the specified object is equal to the current object. (继承自 Object) |
| FromExpression(Activity<Location<T>>) |
初始化和返回使用指定的 InOutArgument<T> 构造的新 Activity<TResult>。Initializes and returns a new InOutArgument<T> constructed using the specified Activity<TResult>. |
| FromVariable(Variable<T>) |
初始化并返回一个使用指定的 InOutArgument<T> 构造的新 Variable<T>。Initializes and returns a new InOutArgument<T> constructed by using the specified Variable<T>. |
| Get(ActivityContext) |
使用指定的 InOutArgument<T> 获取 ActivityContext 的值。Gets the value of the InOutArgument<T> using the specified ActivityContext. |
| Get<T>(ActivityContext) |
使用指定类型和活动上下文获取自变量的值。Gets the value of the argument using the specified type and activity context. (继承自 Argument) |
| GetHashCode() |
作为默认哈希函数。Serves as the default hash function. (继承自 Object) |
| GetLocation(ActivityContext) |
获取 InOutArgument<T> 的值的位置。Gets the location of the value for the InOutArgument<T>. |
| GetType() |
获取当前实例的 Type。Gets the Type of the current instance. (继承自 Object) |
| MemberwiseClone() |
创建当前 Object 的浅表副本。Creates a shallow copy of the current Object. (继承自 Object) |
| Set(ActivityContext, Object) |
使用指定活动上下文设置参数的值。Sets the value of the argument using the specified activity context. (继承自 Argument) |
| Set(ActivityContext, T) |
使用指定值设置参数的值。Sets the value of the argument using the specified value. |
| ToString() |
返回表示当前对象的字符串。Returns a string that represents the current object. (继承自 Object) |
运算符
| Implicit(Activity<Location<T>> to InOutArgument<T>) |
初始化和返回使用指定的 InOutArgument<T> 构造的新 Activity<TResult>。Initializes and returns a new InOutArgument<T> constructed using the specified Activity<TResult>. |
| Implicit(Variable<T> to InOutArgument<T>) |
初始化和返回使用指定的 InOutArgument<T> 构造的新 Variable<T>。Initializes and returns a new InOutArgument<T> constructed using the specified Variable<T>. |