共用方式為


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

備註

例如,每當應用程式需要將新元素新增至相關ConfigurationElementCollection集合時,您就會建立 類別的新實例ConfigurationElement

適用於