CodeSnippetCompileUnit 构造函数

定义

初始化 CodeSnippetCompileUnit 类的新实例。

重载

CodeSnippetCompileUnit()

初始化 CodeSnippetCompileUnit 类的新实例。

CodeSnippetCompileUnit(String)

初始化 CodeSnippetCompileUnit 类的新实例。

CodeSnippetCompileUnit()

Source:
CodeSnippetCompileUnit.cs
Source:
CodeSnippetCompileUnit.cs
Source:
CodeSnippetCompileUnit.cs

初始化 CodeSnippetCompileUnit 类的新实例。

public:
 CodeSnippetCompileUnit();
public CodeSnippetCompileUnit ();
Public Sub New ()

注解

如果使用此构造函数, Value 还应设置 属性。

适用于

CodeSnippetCompileUnit(String)

Source:
CodeSnippetCompileUnit.cs
Source:
CodeSnippetCompileUnit.cs
Source:
CodeSnippetCompileUnit.cs

初始化 CodeSnippetCompileUnit 类的新实例。

public:
 CodeSnippetCompileUnit(System::String ^ value);
public CodeSnippetCompileUnit (string value);
new System.CodeDom.CodeSnippetCompileUnit : string -> System.CodeDom.CodeSnippetCompileUnit
Public Sub New (value As String)

参数

value
String

要表示的原义代码片段。

示例

下面的代码示例演示如何使用表示文本代码的 CodeSnippetCompileUnit 字符串创建 类的新实例。

// Creates a compile unit using a literal sring;
String^ literalCode;
literalCode = "using System; namespace TestLiteralCode " +
   "{ public class TestClass { public TestClass() {} } }";
CodeSnippetCompileUnit^ csu = gcnew CodeSnippetCompileUnit( literalCode );
// Creates a compile unit using a literal sring;
string literalCode;
literalCode = "using System; namespace TestLiteralCode " +
    "{ public class TestClass { public TestClass() {} } }";
CodeSnippetCompileUnit csu = new CodeSnippetCompileUnit( literalCode );
' Creates a compile unit using a literal sring.
Dim literalCode As String
literalCode = "using System; namespace TestLiteralCode " & _
    "{ public class TestClass { public TestClass() {} } }"
Dim csu As New CodeSnippetCompileUnit(literalCode)

适用于