Redigera

Dela via


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

Gets the configuration element at the specified index location.

protected public:
 System::Configuration::ConfigurationElement ^ BaseGet(int index);
protected:
 System::Configuration::ConfigurationElement ^ BaseGet(int index);
protected internal System.Configuration.ConfigurationElement BaseGet (int index);
protected System.Configuration.ConfigurationElement BaseGet (int index);
member this.BaseGet : int -> System.Configuration.ConfigurationElement
Protected Friend Function BaseGet (index As Integer) As ConfigurationElement
Protected Function BaseGet (index As Integer) As ConfigurationElement

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.

public UrlConfigElement this[int index]
{
    get
    {
        return (UrlConfigElement)BaseGet(index);
    }
    set
    {
        if (BaseGet(index) != null)
        {
            BaseRemoveAt(index);
        }
        BaseAdd(index, value);
    }
}
Default Public Shadows Property Item(ByVal index As Integer) As UrlConfigElement
    Get
        Return CType(BaseGet(index), UrlConfigElement)
    End Get
    Set(ByVal value As UrlConfigElement)
        If BaseGet(index) IsNot Nothing Then
            BaseRemoveAt(index)
        End If
        BaseAdd(value)
    End Set
End Property

Applies to

BaseGet(Object)

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

Returns the configuration element with the specified key.

protected public:
 System::Configuration::ConfigurationElement ^ BaseGet(System::Object ^ key);
protected:
 System::Configuration::ConfigurationElement ^ BaseGet(System::Object ^ key);
protected internal System.Configuration.ConfigurationElement BaseGet (object key);
protected System.Configuration.ConfigurationElement BaseGet (object key);
member this.BaseGet : obj -> System.Configuration.ConfigurationElement
Protected Friend Function BaseGet (key As Object) As ConfigurationElement
Protected Function BaseGet (key As Object) As ConfigurationElement

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.

new public UrlConfigElement this[string Name]
{
    get
    {
        return (UrlConfigElement)BaseGet(Name);
    }
}
Default Public Shadows ReadOnly Property Item(ByVal Name As String) As UrlConfigElement
    Get
        Return CType(BaseGet(Name), UrlConfigElement)
    End Get
End Property

Remarks

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

Applies to