Share via


ConfigurationSectionGroupCollection.GetKey(Int32) 方法

定义

获取此 ConfigurationSectionGroupCollection 对象中包含的指定 ConfigurationSectionGroup 对象的键。

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

要返回其键的节组的索引。

返回

位于指定索引处的 ConfigurationSectionGroup 对象的键。

示例

下面的代码示例说明如何使用 GetKey 方法。

int i = 0;
while (groupEnum.MoveNext())
{
    string groupName = groups.GetKey(i);
    Console.WriteLine(
        "Group name: {0}", groupName);
    i += 1;
}
Dim i As Integer = 0
While groupEnum.MoveNext()
   Dim groupName As String = groups.GetKey(i)
   Console.WriteLine("Group name: {0}", groupName)
   i += 1
End While

适用于

另请参阅