ConfigurationElementCollection.BaseGet Method

Definition

Gets the ConfigurationElement at the specified index location.

Overloads

BaseGet(Int32)

Gets the configuration element at the specified index location.

BaseGet(Object)

Returns the configuration element with the specified key.

BaseGet(Int32)

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

Gets the configuration element at the specified index location.

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

Parameters

index
Int32

The index location of the ConfigurationElement to return.

Returns

The ConfigurationElement at the specified index.

Exceptions

index is less than 0.

-or-

There is no ConfigurationElement at the specified index.

Examples

The following code example shows how to call the BaseGet method.

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

Applies to

.NET 9 (package-provided) and other versions
Product Versions
.NET 8 (package-provided), 9 (package-provided)
.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 (package-provided), 4.7, 4.7.1 (package-provided), 4.7.1, 4.7.2 (package-provided), 4.7.2, 4.8 (package-provided), 4.8, 4.8.1
.NET Standard 2.0 (package-provided)
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9

BaseGet(Object)

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

Returns the configuration element with the specified key.

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

Parameters

key
Object

The key of the element to return.

Returns

The ConfigurationElement with the specified key; otherwise, null.

Examples

The following code example shows how to call the BaseGet method.

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

Remarks

The BaseGet method returns null if there is no ConfigurationElement object with the specified key in the collection.

Applies to

.NET 9 (package-provided) and other versions
Product Versions
.NET 8 (package-provided), 9 (package-provided)
.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 (package-provided), 4.7, 4.7.1 (package-provided), 4.7.1, 4.7.2 (package-provided), 4.7.2, 4.8 (package-provided), 4.8, 4.8.1
.NET Standard 2.0 (package-provided)
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9