ConfigurationElement Konstruktor

Definition

Initierar en ny instans av ConfigurationElement klassen.

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

Exempel

I följande exempel visas hur du använder en anpassad konstruktor.

// 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

Kommentarer

Du skapar en ny instans av ConfigurationElement klassen, till exempel varje gång programmet behöver lägga till ett nytt element i den relaterade ConfigurationElementCollection samlingen.

Gäller för