This documentation is archived and is not being maintained.

CodeSnippetStatement Class

Represents a statement using a literal code fragment.

For a list of all members of this type, see CodeSnippetStatement Members.


[Visual Basic]
Public Class CodeSnippetStatement
   Inherits CodeStatement
public class CodeSnippetStatement : CodeStatement
public __gc class CodeSnippetStatement : public CodeStatement
class CodeSnippetStatement extends CodeStatement

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.


CodeSnippetStatement can represent a statement using a literal code fragment that will be included directly in the source without modification.

A CodeSnippetStatement stores a section of code exactly in its original format as a string. The CodeDOM does not translate literal code fragments. Literal code fragments are stored and output in their original format. 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 the snippet statement.


[Visual Basic] 
' Creates a statement using a literal string.
Dim literalStatement As New CodeSnippetStatement( _
    "Console.Write(""Test literal statement output"")")

// Creates a statement using a literal string.
CodeSnippetStatement literalStatement = 
    new CodeSnippetStatement("Console.Write(\"Test literal statement output\")");            

// Creates a statement using a literal string.
CodeSnippetStatement* literalStatement = 
    new CodeSnippetStatement(S"Console.Write(\"Test literal statement output\")");            

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.


Namespace: System.CodeDom

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

Assembly: System (in System.dll)

See Also

CodeSnippetStatement Members | System.CodeDom Namespace