Variable<T> Class

.NET Framework (current version)
 

Represents a variable in a workflow.

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

System.Object
  System.Activities.LocationReference
    System.Activities.Variable
      System.Activities.Variable<T>

public sealed class Variable<T> : Variable

Type Parameters

T

The Type of the Variable<T>.

NameDescription
System_CAPS_pubmethodVariable<T>()

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

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

Initializes a new instance of the Variable<T> class with the default expression.

System_CAPS_pubmethodVariable<T>(String)

Initializes a new instance of the Variable<T> class with the variable name.

System_CAPS_pubmethodVariable<T>(String, T)

Initializes a new instance of the Variable<T> class with the variable name and default value.

System_CAPS_pubmethodVariable<T>(String, Expression<Func<ActivityContext, T>>)

Initializes a new instance of the Variable<T> class with the variable name and default expression.

NameDescription
System_CAPS_pubpropertyDefault

Gets or sets the Activity<TResult> that represents the default value for this Variable<T>.

System_CAPS_pubpropertyModifiers

Gets or sets the VariableModifiers value for this Variable.(Inherited from Variable.)

System_CAPS_pubpropertyName

Gets or sets the name of the Variable.(Inherited from Variable.)

System_CAPS_pubpropertyType

Gets or sets the type of the LocationReference.(Inherited from LocationReference.)

NameDescription
System_CAPS_pubmethodEquals(Object)

Determines whether the specified object is equal to the current object.(Inherited from Object.)

System_CAPS_pubmethodGet(ActivityContext)

Gets the value of the variable using the specified ActivityContext.

System_CAPS_pubmethodGetHashCode()

Serves as the default hash function. (Inherited from Object.)

System_CAPS_pubmethodGetLocation(ActivityContext)

Returns the Location<T> of the variable.

System_CAPS_pubmethodGetType()

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_pubmethodSet(ActivityContext, T)

Sets the value of the variable.

System_CAPS_pubmethodSet(ActivityContext, Object)

Sets the value of the Variable using the specified ActivityContext.(Inherited from Variable.)

System_CAPS_pubmethodToString()

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

.NET Framework
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.

Return to top
Show: