ConfigurationElementCollection.BaseGet Método

Definición

Obtiene el objeto ConfigurationElement en la ubicación de índice especificada.

Sobrecargas

BaseGet(Int32)

Obtiene el elemento de configuración en la ubicación de índice especificada.

BaseGet(Object)

Devuelve el elemento de configuración con la clave especificada.

BaseGet(Int32)

Source:
ConfigurationElementCollection.cs
Source:
ConfigurationElementCollection.cs
Source:
ConfigurationElementCollection.cs

Obtiene el elemento de configuración en la ubicación de índice especificada.

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

Parámetros

index
Int32

Ubicación de índice del objeto ConfigurationElement que se va a devolver.

Devoluciones

Objeto ConfigurationElement en el índice especificado.

Excepciones

index es menor que 0.

o bien

No hay ningún objeto ConfigurationElement en el índice index especificado.

Ejemplos

En el ejemplo de código siguiente se muestra cómo llamar al BaseGet método .

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

Se aplica a

.NET Framework 4.8.1 y otras versiones
Producto Versiones
.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)

Source:
ConfigurationElementCollection.cs
Source:
ConfigurationElementCollection.cs
Source:
ConfigurationElementCollection.cs

Devuelve el elemento de configuración con la clave especificada.

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

Parámetros

key
Object

Clave del elemento que se va a devolver.

Devoluciones

Objeto ConfigurationElement con la clave especificada; en caso contrario, null.

Ejemplos

En el ejemplo de código siguiente se muestra cómo llamar al BaseGet método .

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

Comentarios

El BaseGet método devuelve null si no hay ningún ConfigurationElement objeto con la clave especificada en la colección.

Se aplica a

.NET Framework 4.8.1 y otras versiones
Producto Versiones
.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