Export (0) Print
Expand All

Variable(Of T) Class

Represents a variable in a workflow.

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

'Declaration
Public NotInheritable Class Variable(Of T) _
	Inherits Variable

Type Parameters

T

The Type of the Variable(Of T).

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

  NameDescription
Public methodVariable(Of T)Initializes a new instance of the Variable(Of T) class.
Public methodVariable(Of T)(Expression(Of Func(Of ActivityContext, T)))Initializes a new instance of the Variable(Of T) class with the default expression.
Public methodVariable(Of T)(String)Initializes a new instance of the Variable(Of T) class with the variable name.
Public methodVariable(Of T)(String, Expression(Of Func(Of ActivityContext, T)))Initializes a new instance of the Variable(Of T) class with the variable name and default expression.
Public methodVariable(Of T)(String, T)Initializes a new instance of the Variable(Of T) class with the variable name and default value.
Top

  NameDescription
Public propertyDefaultGets or sets the Activity(Of TResult) that represents the default value for this Variable(Of T).
Public propertyModifiersGets or sets the VariableModifiers value for this Variable. (Inherited from Variable.)
Public propertyNameGets or sets the name of the Variable. (Inherited from Variable.)
Public propertyTypeGets or sets the type of the LocationReference. (Inherited from LocationReference.)
Top

  NameDescription
Public methodEquals(Object)Determines whether the specified object is equal to the current object. (Inherited from Object.)
Public methodGetGets the value of the variable using the specified ActivityContext.
Public methodGetHashCodeServes as the default hash function. (Inherited from Object.)
Public methodGetLocationReturns the Location(Of T) of the variable.
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodSet(ActivityContext, Object)Sets the value of the Variable using the specified ActivityContext. (Inherited from Variable.)
Public methodSet(ActivityContext, T)Sets the value of the variable.
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Top

In this example, a Variable(Of T) is used to hold a message string. This message is written to the console window by a WriteLine activity.

Variable<string> msg = 
    new Variable<string>() { Default = "Hello World!" };

Activity wf = new Sequence()
{
    Variables = 
    {
        msg
    },
    Activities =
    {
        new WriteLine()
        {
            Text = msg
        }
    }
};

.NET Framework

Supported in: 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