ConfigurationElementCollection.BaseGet 方法

定义

获取指定索引位置的 ConfigurationElementGets the ConfigurationElement at the specified index location.

重载

BaseGet(Int32)

获取位于指定索引位置的配置元素。Gets the configuration element at the specified index location.

BaseGet(Object)

返回具有指定键的配置元素。Returns the configuration element with the specified key.

BaseGet(Int32)

获取位于指定索引位置的配置元素。Gets the configuration element at the specified index location.

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

参数

index
Int32

要返回的 ConfigurationElement 的索引位置。The index location of the ConfigurationElement to return.

返回

位于指定索引处的 ConfigurationElementThe ConfigurationElement at the specified index.

例外

index 小于 0index is less than 0.

-or- 指定的 ConfigurationElement 处没有 indexThere is no ConfigurationElement at the specified index.

示例

下面的代码示例演示如何调用 BaseGet 方法。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

BaseGet(Object)

返回具有指定键的配置元素。Returns the configuration element with the specified key.

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

参数

key
Object

要返回的元素的键。The key of the element to return.

返回

具有指定键的 ConfigurationElement;否则为 nullThe ConfigurationElement with the specified key; otherwise, null.

示例

下面的代码示例演示如何调用 BaseGet 方法。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

注解

如果集合中不存在具有指定键的 ConfigurationElement 对象,则 BaseGet 方法返回 nullThe BaseGet method returns null if there is no ConfigurationElement object with the specified key in the collection.

适用于