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

适用于