CodeSnippetExpression 类

定义

表示文本表达式。Represents a literal expression.

public ref class CodeSnippetExpression : System::CodeDom::CodeExpression
[System.Runtime.InteropServices.ComVisible(true)]
[System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)]
[System.Serializable]
public class CodeSnippetExpression : System.CodeDom.CodeExpression
type CodeSnippetExpression = class
    inherit CodeExpression
Public Class CodeSnippetExpression
Inherits CodeExpression
继承
CodeSnippetExpression
属性

示例

下面的代码示例演示如何使用原义代码片段创建CodeSnippetExpression类的实例。The following code example demonstrates how to create an instance of the CodeSnippetExpression class using a literal code fragment.

// Creates a CodeSnippetExpression that represents a literal string that
// can be used as an expression in a CodeDOM graph.
CodeSnippetExpression^ literalExpression =
   gcnew CodeSnippetExpression( "Literal expression" );
// Creates a CodeSnippetExpression that represents a literal string that
// can be used as an expression in a CodeDOM graph.
CodeSnippetExpression literalExpression = 
    new CodeSnippetExpression("Literal expression");
' Creates a CodeSnippetExpression that represents a literal string that
' can be used as an expression in a CodeDOM graph.
Dim literalExpression As New CodeSnippetExpression("Literal expression")

注解

文本表达式将表达式的代码存储为原义代码片段。A literal expression stores the code of an expression as a literal code fragment. CodeDOM 不会转换原义代码片段。The CodeDOM does not translate literal code fragments. 原义代码片段按原样存储和输出。Literal code fragments are stored and output just as they are. 提供了包含原义代码的 CodeDOM 对象, 以便开发人员可以封装目标语言中已经存在的代码。CodeDOM objects that contain literal code are provided so developers can encapsulate code that is already in the target language.

Value属性包含此代码段表达式的文字代码。The Value property contains the literal code for this snippet expression.

构造函数

CodeSnippetExpression()

初始化 CodeSnippetExpression 类的新实例。Initializes a new instance of the CodeSnippetExpression class.

CodeSnippetExpression(String)

使用指定的文本表达式初始化 CodeSnippetExpression 类的新实例。Initializes a new instance of the CodeSnippetExpression class using the specified literal expression.

属性

UserData

获取当前对象的用户可定义数据。Gets the user-definable data for the current object.

(继承自 CodeObject)
Value

获取或设置代码字符串。Gets or sets the literal string of code.

方法

Equals(Object)

确定指定的对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(继承自 Object)
GetHashCode()

作为默认哈希函数。Serves as the default hash function.

(继承自 Object)
GetType()

获取当前实例的 TypeGets the Type of the current instance.

(继承自 Object)
MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(继承自 Object)
ToString()

返回表示当前对象的字符串。Returns a string that represents the current object.

(继承自 Object)

适用于