ConfigurationElementCollection.BaseGet Metoda

Definicja

Pobiera obiekt ConfigurationElement w określonej lokalizacji indeksu.

Przeciążenia

BaseGet(Int32)

Pobiera element konfiguracji w określonej lokalizacji indeksu.

BaseGet(Object)

Zwraca element konfiguracji z określonym kluczem.

BaseGet(Int32)

Źródło:
ConfigurationElementCollection.cs
Źródło:
ConfigurationElementCollection.cs
Źródło:
ConfigurationElementCollection.cs

Pobiera element konfiguracji w określonej lokalizacji indeksu.

C#
protected System.Configuration.ConfigurationElement BaseGet (int index);
C#
protected internal System.Configuration.ConfigurationElement BaseGet (int index);

Parametry

index
Int32

Lokalizacja indeksu do ConfigurationElement zwrócenia.

Zwraca

Element ConfigurationElement w określonym indeksie.

Wyjątki

index wartość jest mniejsza niż 0.

-lub-

Nie ma ConfigurationElement określonej wartości index.

Przykłady

W poniższym przykładzie kodu pokazano, jak wywołać metodę BaseGet .

C#
public UrlConfigElement this[int index]
{
    get
    {
        return (UrlConfigElement)BaseGet(index);
    }
    set
    {
        if (BaseGet(index) != null)
        {
            BaseRemoveAt(index);
        }
        BaseAdd(index, value);
    }
}

Dotyczy

.NET Framework 4.8.1 i inne wersje
Produkt Wersje
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9

BaseGet(Object)

Źródło:
ConfigurationElementCollection.cs
Źródło:
ConfigurationElementCollection.cs
Źródło:
ConfigurationElementCollection.cs

Zwraca element konfiguracji z określonym kluczem.

C#
protected System.Configuration.ConfigurationElement BaseGet (object key);
C#
protected internal System.Configuration.ConfigurationElement BaseGet (object key);

Parametry

key
Object

Klucz elementu do zwrócenia.

Zwraca

Element ConfigurationElement z określonym kluczem; w przeciwnym razie null.

Przykłady

W poniższym przykładzie kodu pokazano, jak wywołać metodę BaseGet .

C#
new public UrlConfigElement this[string Name]
{
    get
    {
        return (UrlConfigElement)BaseGet(Name);
    }
}

Uwagi

Metoda BaseGet zwraca null wartość , jeśli w kolekcji nie ConfigurationElement ma obiektu o określonym kluczu.

Dotyczy

.NET Framework 4.8.1 i inne wersje
Produkt Wersje
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9