Redigera

Dela via


CodeSnippetExpression Class

Definition

Represents a literal expression.

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
Inheritance
CodeSnippetExpression
Attributes

Examples

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

Remarks

A literal expression stores the code of an expression as a literal code fragment. The CodeDOM does not translate literal code fragments. Literal code fragments are stored and output just as they are. CodeDOM objects that contain literal code are provided so developers can encapsulate code that is already in the target language.

The Value property contains the literal code for this snippet expression.

Constructors

CodeSnippetExpression()

Initializes a new instance of the CodeSnippetExpression class.

CodeSnippetExpression(String)

Initializes a new instance of the CodeSnippetExpression class using the specified literal expression.

Properties

UserData

Gets the user-definable data for the current object.

(Inherited from CodeObject)
Value

Gets or sets the literal string of code.

Methods

Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
ToString()

Returns a string that represents the current object.

(Inherited from Object)

Applies to