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

适用于

另请参阅