Variable<T> Class
Represents a variable in a workflow.
Assembly: System.Activities (in System.Activities.dll)
System.Activities::LocationReference
System.Activities::Variable
System.Activities::Variable<T>
| Name | Description | |
|---|---|---|
![]() | Variable<T>() | Initializes a new instance of the Variable<T> class. |
![]() | Variable<T>(Expression<Func<ActivityContext^, T>^>^) | Initializes a new instance of the Variable<T> class with the default expression. |
![]() | Variable<T>(String^) | Initializes a new instance of the Variable<T> class with the variable name. |
![]() | Variable<T>(String^, T) | Initializes a new instance of the Variable<T> class with the variable name and default value. |
![]() | Variable<T>(String^, Expression<Func<ActivityContext^, T>^>^) | Initializes a new instance of the Variable<T> class with the variable name and default expression. |
| Name | Description | |
|---|---|---|
![]() | Default | Gets or sets the Activity<TResult> that represents the default value for this Variable<T>. |
![]() | Modifiers | Gets or sets the VariableModifiers value for this Variable.(Inherited from Variable.) |
![]() | Name | |
![]() | Type | Gets or sets the type of the LocationReference.(Inherited from LocationReference.) |
| Name | Description | |
|---|---|---|
![]() | Equals(Object^) | Determines whether the specified object is equal to the current object.(Inherited from Object.) |
![]() | Get(ActivityContext^) | Gets the value of the variable using the specified ActivityContext. |
![]() | GetHashCode() | Serves as the default hash function. (Inherited from Object.) |
![]() | GetLocation(ActivityContext^) | Returns the Location<T> of the variable. |
![]() | GetType() | |
![]() | Set(ActivityContext^, T) | Sets the value of the variable. |
![]() | Set(ActivityContext^, Object^) | Sets the value of the Variable using the specified ActivityContext.(Inherited from Variable.) |
![]() | ToString() | Returns a string that represents the current object.(Inherited from Object.) |
In this example, a Variable<T> is used to hold a message string. This message is written to the console window by a T:System.Activities.WriteLine activity.
Variable<string> msg = new Variable<string>() { Default = "Hello World!" }; Activity wf = new Sequence() { Variables = { msg }, Activities = { new WriteLine() { Text = msg } } };
Available since 4.0
Any public static ( Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

