Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

CodeSnippetTypeMember Class

Represents a member of a type using a literal code fragment.

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

System.Object
   System.CodeDom.CodeObject
      System.CodeDom.CodeTypeMember
         System.CodeDom.CodeSnippetTypeMember

[Visual Basic]
<Serializable>
<ClassInterface(ClassInterfaceType.AutoDispatch)>
<ComVisible(True)>
Public Class CodeSnippetTypeMember
   Inherits CodeTypeMember
[C#]
[Serializable]
[ClassInterface(ClassInterfaceType.AutoDispatch)]
[ComVisible(true)]
public class CodeSnippetTypeMember : CodeTypeMember
[C++]
[Serializable]
[ClassInterface(ClassInterfaceType::AutoDispatch)]
[ComVisible(true)]
public __gc class CodeSnippetTypeMember : public CodeTypeMember
[JScript]
public
   Serializable
 ClassInterface(ClassInterfaceType.AutoDispatch)
 ComVisible(true)
class CodeSnippetTypeMember extends CodeTypeMember

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

CodeSnippetTypeMember can represent a member of a type using a literal code fragment that is included directly in the source without modification. This code can be included in the type declaration.

A CodeSnippetTypeMember 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 Text property contains the literal code for the type member.

Example

[Visual Basic] 
' Creates a type member using a literal string.
Dim literalMember As New CodeSnippetTypeMember("public static void TestMethod() {}")

[C#] 
// Creates a type member using a literal string.
CodeSnippetTypeMember literalMember = 
    new CodeSnippetTypeMember("public static void TestMethod() {}");

[C++] 
// Creates a type member using a literal string.
CodeSnippetTypeMember* literalMember = 
    new CodeSnippetTypeMember(S"public static void TestMethod() {}");

[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

CodeSnippetTypeMember Members | System.CodeDom Namespace

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.