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.

System.Object
   System.CodeDom.CodeObject
      System.CodeDom.CodeStatement
         System.CodeDom.CodeSnippetStatement

[Visual Basic]
<Serializable>
<ClassInterface(ClassInterfaceType.AutoDispatch)>
<ComVisible(True)>
Public Class CodeSnippetStatement
   Inherits CodeStatement
[C#]
[Serializable]
[ClassInterface(ClassInterfaceType.AutoDispatch)]
[ComVisible(true)]
public class CodeSnippetStatement : CodeStatement
[C++]
[Serializable]
[ClassInterface(ClassInterfaceType::AutoDispatch)]
[ComVisible(true)]
public __gc class CodeSnippetStatement : public CodeStatement
[JScript]
public
   Serializable
 ClassInterface(ClassInterfaceType.AutoDispatch)
 ComVisible(true)
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.

Remarks

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.

Example

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

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

[C++] 
// 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.

Requirements

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

Show: