共用方式為


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

適用於

另請參閱