Redigera

Dela via


InOutArgument<T> Class

Definition

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

Type Parameters

T

The data type of the InOutArgument<T>.

Inheritance
InOutArgument<T>
Attributes

Remarks

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

Constructors

InOutArgument<T>()

Initializes a new instance of the InOutArgument<T> class using default values.

InOutArgument<T>(Activity<Location<T>>)

Initializes a new instance of the InOutArgument<T> class using the specified Activity<TResult>.

InOutArgument<T>(Expression<Func<ActivityContext,T>>)

Initializes a new instance of the InOutArgument<T> class using the specified expression.

InOutArgument<T>(Variable)

Initializes a new instance of the InOutArgument<T> class using the specified Variable.

InOutArgument<T>(Variable<T>)

Initializes a new instance of the InOutArgument<T> class using the specified Variable<T>.

Fields

ResultValue

Represents the constant value of "Result", which corresponds to the name of the Result property of type OutArgument in the expression base class ActivityWithResult.

(Inherited from Argument)

Properties

ArgumentType

Gets the data type for the data bound to this Argument.

(Inherited from Argument)
Direction

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.

(Inherited from Argument)
EvaluationOrder

Gets or sets a zero-based value that specifies the order in which the argument is evaluated.

(Inherited from Argument)
Expression

Gets an Activity<TResult> that represents the value of this InOutArgument<T>.

Methods

Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
FromExpression(Activity<Location<T>>)

Initializes and returns a new InOutArgument<T> constructed using the specified Activity<TResult>.

FromVariable(Variable<T>)

Initializes and returns a new InOutArgument<T> constructed by using the specified Variable<T>.

Get(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.

(Inherited from Argument)
GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetLocation(ActivityContext)

Gets the location of the value for the InOutArgument<T>.

GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
Set(ActivityContext, Object)

Sets the value of the argument using the specified activity context.

(Inherited from Argument)
Set(ActivityContext, T)

Sets the value of the argument using the specified value.

ToString()

Returns a string that represents the current object.

(Inherited from Object)

Operators

Implicit(Activity<Location<T>> to InOutArgument<T>)

Initializes and returns a new InOutArgument<T> constructed using the specified Activity<TResult>.

Implicit(Variable<T> to InOutArgument<T>)

Initializes and returns a new InOutArgument<T> constructed using the specified Variable<T>.

Applies to