語言

ConfigurationElement 建構函式

定義

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

protected:
 ConfigurationElement();
protected ConfigurationElement();
Protected Sub New ()

範例

以下範例展示了如何使用自訂建構子。

// Constructor allowing name, url, and port to be specified.
public UrlConfigElement(String newName,
    String newUrl, int newPort)
{
    Name = newName;
    Url = newUrl;
    Port = newPort;
}
' Constructor allowing name, url, and port to be specified.
Public Sub New(ByVal newName As String, _
    ByVal newUrl As String, _
    ByVal newPort As Integer)

    Name = newName
    Url = newUrl
    Port = newPort

End Sub

備註

例如,每次應用程式需要新增元素到相關ConfigurationElement集合時,你都會建立一個新的類別實例ConfigurationElementCollection。

適用於