ConfigurationElementCollection.BaseGet 方法

定义

获取指定索引位置的 ConfigurationElement

重载

BaseGet(Int32)

获取位于指定索引位置的配置元素。

BaseGet(Object)

返回具有指定键的配置元素。

BaseGet(Int32)

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

获取位于指定索引位置的配置元素。

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 的索引位置。

返回

指定索引处的 ConfigurationElement

例外

index 小于 0

- 或 -

指定的 index 处没有 ConfigurationElement

示例

下面的代码示例演示如何调用 BaseGet 方法。

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)

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

返回具有指定键的配置元素。

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

要返回的元素的键。

返回

具有指定键的 ConfigurationElement;否则为 null

示例

下面的代码示例演示如何调用 BaseGet 方法。

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方法返回 null

适用于