HttpApplicationState.GetKey(Int32) 方法

定义

通过索引获取 HttpApplicationState 对象名。

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

应用程序状态对象的索引。

返回

String

保存应用程序状态对象所使用的名称。

示例

以下示例返回应用程序状态集合中所有对象的名称,并将名称存储在字符串数组中。

int Loop1;
String[] StateVars = new String[Application.Count];

for (Loop1 = 0; Loop1 < Application.Count; Loop1++)
{
   StateVars[Loop1] = Application.GetKey(Loop1);
}
Dim Loop1 As Integer
Dim StateVars(Application.Count) As String
 
For Loop1 = 0 To Application.Count -1
   StateVars(Loop1) = Application.GetKey(Loop1)
Next Loop1

适用于