CodeTypeReferenceExpression 类
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
表示对某数据类型的引用。
public ref class CodeTypeReferenceExpression : System::CodeDom::CodeExpression
C#
public class CodeTypeReferenceExpression : System.CodeDom.CodeExpression
C#
[System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)]
[System.Runtime.InteropServices.ComVisible(true)]
[System.Serializable]
public class CodeTypeReferenceExpression : System.CodeDom.CodeExpression
type CodeTypeReferenceExpression = class
inherit CodeExpression
[<System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)>]
[<System.Runtime.InteropServices.ComVisible(true)>]
[<System.Serializable>]
type CodeTypeReferenceExpression = class
inherit CodeExpression
Public Class CodeTypeReferenceExpression
Inherits CodeExpression
- 继承
- 属性
以下示例演示如何使用 CodeTypeReferenceExpression 表示对类型的引用。
// Creates an expression referencing the System.DateTime type.
CodeTypeReferenceExpression^ typeRef1 = gcnew CodeTypeReferenceExpression("System.DateTime");
// Create a C# code provider
CodeDomProvider^ provider = CodeDomProvider::CreateProvider("CSharp");
// Generate code and send the output to the console
provider->GenerateCodeFromExpression(typeRef1, Console::Out, gcnew CodeGeneratorOptions());
// The code generator produces the following source code for the preceeding example code:
// System.DateTime
C#
// Creates an expression referencing the System.DateTime type.
CodeTypeReferenceExpression typeRef1 = new CodeTypeReferenceExpression("System.DateTime");
// Create a C# code provider
CodeDomProvider provider = CodeDomProvider.CreateProvider("CSharp");
// Generate code and send the output to the console
provider.GenerateCodeFromExpression(typeRef1, Console.Out, new CodeGeneratorOptions());
// The code generator produces the following source code for the preceeding example code:
// System.DateTime
' Creates an expression referencing the System.DateTime type.
Dim typeRef1 As new CodeTypeReferenceExpression("System.DateTime")
' Create a Visual Basic code provider
Dim provider As CodeDomProvider = CodeDomProvider.CreateProvider("VisualBasic")
' Generate code and send the output to the console
provider.GenerateCodeFromExpression(typeRef1, Console.Out, New CodeGeneratorOptions())
' The code generator produces the following source code for the preceeding example code:
' Date
CodeTypeReferenceExpression 可用于引用特定数据类型。
属性 Type 指定要引用的数据类型。
Code |
初始化 CodeTypeReferenceExpression 类的新实例。 |
Code |
使用指定的类型初始化 CodeTypeReferenceExpression 类的新实例。 |
Code |
使用指定的数据类型名称初始化 CodeTypeReferenceExpression 类的新实例。 |
Code |
使用指定的数据类型初始化 CodeTypeReferenceExpression 类的新实例。 |
Type |
获取或设置要引用的数据类型。 |
User |
获取当前对象的用户可定义数据。 (继承自 CodeObject) |
Equals(Object) |
确定指定对象是否等于当前对象。 (继承自 Object) |
Get |
作为默认哈希函数。 (继承自 Object) |
Get |
获取当前实例的 Type。 (继承自 Object) |
Memberwise |
创建当前 Object 的浅表副本。 (继承自 Object) |
To |
返回表示当前对象的字符串。 (继承自 Object) |
产品 | 版本 |
---|---|
.NET Framework | 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
Windows Desktop | 3.0, 3.1, 5, 6, 7, 8, 9 |