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.)
Protected propertyNameCoreGets the name of the Variable. (Inherited from Variable.)
Public propertyTypeGets or sets the type of the LocationReference. (Inherited from LocationReference.)
Protected propertyTypeCoreWhen implemented in a derived class, gets or sets the culturally localized version of 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.)
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 methodGetGets the value of the variable using the specified ActivityContext.
Public methodGetHashCodeServes as a hash function for a particular type. (Inherited from Object.)
Public methodGetLocationReturns the Location(Of T) of the variable.
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 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

.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