Export (0) Print
Expand All

CodeVariableReferenceExpression Class

Represents a reference to a local variable.

For a list of all members of this type, see CodeVariableReferenceExpression Members.

System.Object
   System.CodeDom.CodeObject
      System.CodeDom.CodeExpression
         System.CodeDom.CodeVariableReferenceExpression

[Visual Basic]
<Serializable>
<ClassInterface(ClassInterfaceType.AutoDispatch)>
<ComVisible(True)>
Public Class CodeVariableReferenceExpression
   Inherits CodeExpression
[C#]
[Serializable]
[ClassInterface(ClassInterfaceType.AutoDispatch)]
[ComVisible(true)]
public class CodeVariableReferenceExpression : CodeExpression
[C++]
[Serializable]
[ClassInterface(ClassInterfaceType::AutoDispatch)]
[ComVisible(true)]
public __gc class CodeVariableReferenceExpression : public
   CodeExpression
[JScript]
public
   Serializable
 ClassInterface(ClassInterfaceType.AutoDispatch)
 ComVisible(true)
class CodeVariableReferenceExpression extends
   CodeExpression

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Remarks

CodeVariableReferenceExpression can be used to represent a reference to a local variable.

The VariableName property specifies the name of the local variable to reference.

Use CodeFieldReferenceExpression to reference a field. Use CodePropertyReferenceExpression to reference a property. Use CodeEventReferenceExpression to reference an event.

Example

[Visual Basic, C#, C++] The following example code demonstrates use of a CodeVariableReferenceExpression to refer to a local variable.

[Visual Basic] 
Dim variableRef1 As New CodeVariableReferenceExpression("TestVariable")
' A Visual Basic code generator produces the following source code for the preceeding example code:

'    TestVariable

[C#] 
CodeVariableReferenceExpression variableRef1 =
    new CodeVariableReferenceExpression("TestVariable");

// A C# code generator produces the following source code for the preceeding example code:

//    TestVariable

[C++] 
CodeVariableReferenceExpression* variableRef1 =
    new CodeVariableReferenceExpression(S"TestVariable");

// A C# code generator produces the following source code for the preceeding example code:

//    TestVariable

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Namespace: System.CodeDom

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

Assembly: System (in System.dll)

See Also

CodeVariableReferenceExpression Members | System.CodeDom Namespace

Show:
© 2014 Microsoft