共用方式為


CodeSnippetCompileUnit 建構函式

定義

初始化 CodeSnippetCompileUnit 類別的新執行個體。

多載

CodeSnippetCompileUnit()

初始化 CodeSnippetCompileUnit 類別的新執行個體。

CodeSnippetCompileUnit(String)

初始化 CodeSnippetCompileUnit 類別的新執行個體。

CodeSnippetCompileUnit()

來源:
CodeSnippetCompileUnit.cs
來源:
CodeSnippetCompileUnit.cs
來源:
CodeSnippetCompileUnit.cs

初始化 CodeSnippetCompileUnit 類別的新執行個體。

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

備註

如果您使用這個建構函式,則也應該設定 Value 屬性。

適用於

CodeSnippetCompileUnit(String)

來源:
CodeSnippetCompileUnit.cs
來源:
CodeSnippetCompileUnit.cs
來源:
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)

適用於