語言

ConfigurationSectionCollection.GetKey(Int32) 方法

定義

取得該ConfigurationSection物件所包含的指定ConfigurationSectionCollection物件的金鑰。

public:
 System::String ^ GetKey(int index);
public string GetKey(int index);
member this.GetKey : int -> string
Public Function GetKey (index As Integer) As String

參數

index
Int32

要回傳金鑰的物件的 ConfigurationSection 索引。

傳回

物件在指定索引處的 ConfigurationSection 鍵。

範例

以下程式碼範例展示了如何使用 GetKey。

int i = 0;
while (secEnum.MoveNext())
{
    string setionName = sections.GetKey(i);
    Console.WriteLine(
        "Section name: {0}", setionName);
    i += 1;
}
Dim i As Integer = 0
While secEnum.MoveNext()
    Dim setionName _
    As String = sections.GetKey(i)
    Console.WriteLine( _
    "Section name: {0}", setionName)
    i += 1
End While

適用於

另請參閱