CodeSnippetExpression 類別

定義

表示常值 (Literal) 運算式。

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

範例

下列程式代碼範例示範如何使用常值代碼段建立 類別的 CodeSnippetExpression 實例。

// 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")

備註

常值表達式會將表達式的程式代碼儲存為常值代碼段。 CodeDOM 不會轉譯常值代碼段。 常值代碼段會儲存並輸出,就像是一樣。 提供包含常值程式代碼的CodeDOM物件,讓開發人員可以封裝已在目標語言中的程式碼。

屬性 Value 包含這個代碼段表達式的常值程序代碼。

建構函式

CodeSnippetExpression()

初始化 CodeSnippetExpression 類別的新執行個體。

CodeSnippetExpression(String)

使用指定的常值運算式,來初始化 CodeSnippetExpression 類別的新執行個體。

屬性

UserData

取得目前物件的使用者可定義資料。

(繼承來源 CodeObject)
Value

取得或設定程式碼的常值字串。

方法

Equals(Object)

判斷指定的物件是否等於目前的物件。

(繼承來源 Object)
GetHashCode()

做為預設雜湊函式。

(繼承來源 Object)
GetType()

取得目前執行個體的 Type

(繼承來源 Object)
MemberwiseClone()

建立目前 Object 的淺層複製。

(繼承來源 Object)
ToString()

傳回代表目前物件的字串。

(繼承來源 Object)

適用於