ConfigurationElementCollection.BaseGet 方法

定義

取得位在指定之索引位置的 ConfigurationElement

多載

BaseGet(Int32)

取得位在指定之索引位置的組態項目。

BaseGet(Object)

傳回具有指定索引鍵的組態項目。

BaseGet(Int32)

來源:
ConfigurationElementCollection.cs
來源:
ConfigurationElementCollection.cs
來源:
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)

來源:
ConfigurationElementCollection.cs
來源:
ConfigurationElementCollection.cs
來源:
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具有指定索引鍵的物件,則方法BaseGetnull傳回 。

適用於