Export (0) Print
Expand All

InOutArgument(Of T) Class

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

System.Object
  System.Activities.Argument
    System.Activities.InOutArgument
      System.Activities.InOutArgument(Of T)

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

'Declaration
<TypeConverterAttribute(GetType(InOutArgumentConverter))> _
<ContentPropertyAttribute("Expression")> _
Public NotInheritable Class InOutArgument(Of T) _
	Inherits InOutArgument

Type Parameters

T

The data type of the InOutArgument(Of T).

The InOutArgument(Of T) type exposes the following members.

  NameDescription
Public methodInOutArgument(Of T)Initializes a new instance of the InOutArgument(Of T) class using default values.
Public methodInOutArgument(Of T)(Activity(Of Location(Of T)))Initializes a new instance of the InOutArgument(Of T) class using the specified Activity(Of TResult).
Public methodInOutArgument(Of T)(Expression(Of Func(Of ActivityContext, T)))Initializes a new instance of the InOutArgument(Of T) class using the specified expression.
Public methodInOutArgument(Of T)(Variable)Initializes a new instance of the InOutArgument(Of T) class using the specified Variable.
Public methodInOutArgument(Of T)(Variable(Of T))Initializes a new instance of the InOutArgument(Of T) class using the specified Variable(Of 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(Of TResult) that represents the value of this InOutArgument(Of T).
Top

  NameDescription
Public methodEquals(Object)Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodStatic memberFromExpressionInitializes and returns a new InOutArgument(Of T) constructed using the specified Activity(Of TResult).
Public methodStatic memberFromVariableInitializes and returns a new InOutArgument(Of T) constructed by using the specified Variable(Of T).
Public methodGetGets the value of the InOutArgument(Of T) using the specified ActivityContext.
Public methodGetHashCodeServes as a hash function for a particular type. (Inherited from Object.)
Public methodGetLocationGets the location of the value for the InOutArgument(Of T).
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (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 memberWidening(Activity(Of Location(Of T)) to InOutArgument(Of T))Initializes and returns a new InOutArgument(Of T) constructed using the specified Activity(Of TResult).
Public operatorStatic memberWidening(Variable(Of T) to InOutArgument(Of T))Initializes and returns a new InOutArgument(Of T) constructed using the specified Variable(Of T).
Top

In this example, a custom Square activity has an InOutArgument(Of 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

.NET Framework Client Profile

Supported in: 4

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

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.

Community Additions

ADD
Show:
© 2014 Microsoft