Export (0) Print
Expand All

InOutArgument<T> Class

A binding terminal that represents the flow of data into and out of an activity.

Namespace:  System.Activities
Assembly:  System.Activities (in System.Activities.dll)

[TypeConverterAttribute(typeof(InOutArgumentConverter))]
[ContentPropertyAttribute("Expression")]
public sealed class InOutArgument<T> : InOutArgument

Type Parameters

T

The data type of the InOutArgument<T>.

The InOutArgument<T> type exposes the following members.

  NameDescription
Public methodInOutArgument<T>()Initializes a new instance of the InOutArgument<T> class using default values.
Public methodInOutArgument<T>(Activity<Location<T>>)Initializes a new instance of the InOutArgument<T> class using the specified Activity<TResult>.
Public methodInOutArgument<T>(Expression<Func<ActivityContext, T>>)Initializes a new instance of the InOutArgument<T> class using the specified expression.
Public methodInOutArgument<T>(Variable)Initializes a new instance of the InOutArgument<T> class using the specified Variable.
Public methodInOutArgument<T>(Variable<T>)Initializes a new instance of the InOutArgument<T> class using the specified Variable<T>.
Top

  NameDescription
Public propertyArgumentTypeGets the data type for the data bound to this Argument. (Inherited from Argument.)
Public propertyDirectionGets 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. (Inherited from Argument.)
Public propertyEvaluationOrderGets or sets a zero-based value that specifies the order in which the argument is evaluated. (Inherited from Argument.)
Public propertyExpressionGets an Activity<TResult> that represents the value of this InOutArgument<T>.
Top

  NameDescription
Public methodEquals(Object)Determines whether the specified object is equal to the current object. (Inherited from Object.)
Public methodStatic memberFromExpressionInitializes and returns a new InOutArgument<T> constructed using the specified Activity<TResult>.
Public methodStatic memberFromVariableInitializes and returns a new InOutArgument<T> constructed by using the specified Variable<T>.
Public methodGetGets the value of the InOutArgument<T> using the specified ActivityContext.
Public methodGetHashCodeServes as the default hash function. (Inherited from Object.)
Public methodGetLocationGets the location of the value for the InOutArgument<T>.
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodSet(ActivityContext, Object)Sets the value of the argument using the specified activity context. (Inherited from Argument.)
Public methodSet(ActivityContext, T)Sets the value of the argument using the specified value.
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Top

  NameDescription
Public operatorStatic memberImplicit(Activity<Location<T>> to InOutArgument<T>)Initializes and returns a new InOutArgument<T> constructed using the specified Activity<TResult>.
Public operatorStatic memberImplicit(Variable<T> to InOutArgument<T>)Initializes and returns a new InOutArgument<T> constructed using the specified Variable<T>.
Top

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));
    }
}

In the following example, the Square activity is hosted in a workflow. 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);

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4

.NET Framework Client Profile

Supported in: 4

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Show:
© 2014 Microsoft