This documentation is archived and is not being maintained.

CodeTypeReferenceExpression Class

Represents a reference to a data type.

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

System.Object
   System.CodeDom.CodeObject
      System.CodeDom.CodeExpression
         System.CodeDom.CodeTypeReferenceExpression

[Visual Basic]
<Serializable>
<ClassInterface(ClassInterfaceType.AutoDispatch)>
<ComVisible(True)>
Public Class CodeTypeReferenceExpression
   Inherits CodeExpression
[C#]
[Serializable]
[ClassInterface(ClassInterfaceType.AutoDispatch)]
[ComVisible(true)]
public class CodeTypeReferenceExpression : CodeExpression
[C++]
[Serializable]
[ClassInterface(ClassInterfaceType::AutoDispatch)]
[ComVisible(true)]
public __gc class CodeTypeReferenceExpression : public
   CodeExpression
[JScript]
public
   Serializable
 ClassInterface(ClassInterfaceType.AutoDispatch)
 ComVisible(true)
class CodeTypeReferenceExpression 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

CodeTypeReferenceExpression can be used to reference a particular data type.

The Type property specifies the data type to reference.

Example

[Visual Basic, C#, C++] The following example demonstrates use of a CodeTypeReferenceExpression to represent a reference to a type.

[Visual Basic] 
' Creates an expression referencing the System.DateTime type.
Dim typeRef2 As New CodeTypeReferenceExpression("System.DateTime")

' A Visual Basic code generator produces the following source code for the preceeding example code:    

'       System.DateTime

[C#] 
// Creates an expression referencing the System.DateTime type.
CodeTypeReferenceExpression typeRef2 = new CodeTypeReferenceExpression("System.DateTime");

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

//    System.DateTime


[C++] 
// Creates an expression referencing the System.DateTime type.
CodeTypeReferenceExpression* typeRef2 = new CodeTypeReferenceExpression(S"System.DateTime");

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

//    System.DateTime

[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

CodeTypeReferenceExpression Members | System.CodeDom Namespace

Show: