CodeSnippetExpression CodeSnippetExpression CodeSnippetExpression CodeSnippetExpression Class

定義

表示常值 (Literal) 運算式。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
繼承
CodeSnippetExpressionCodeSnippetExpressionCodeSnippetExpressionCodeSnippetExpression
屬性

範例

下列程式碼範例示範如何使用常值程式碼片段來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() CodeSnippetExpression() CodeSnippetExpression()

初始化 CodeSnippetExpression 類別的新執行個體。Initializes a new instance of the CodeSnippetExpression class.

CodeSnippetExpression(String) CodeSnippetExpression(String) CodeSnippetExpression(String) CodeSnippetExpression(String)

使用指定的常值運算式,來初始化 CodeSnippetExpression 類別的新執行個體。Initializes a new instance of the CodeSnippetExpression class using the specified literal expression.

屬性

UserData UserData UserData UserData

取得目前物件的使用者可定義資料。Gets the user-definable data for the current object.

(Inherited from CodeObject)
Value Value Value Value

取得或設定程式碼的常值字串。Gets or sets the literal string of code.

方法

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

判斷指定的物件是否等於目前的物件。Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

做為預設雜湊函式。Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

取得目前執行個體的 TypeGets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

建立目前 Object 的淺層複本 (Shallow Copy)。Creates a shallow copy of the current Object.

(Inherited from Object)
ToString() ToString() ToString() ToString()

傳回代表目前物件的字串。Returns a string that represents the current object.

(Inherited from Object)

適用於