共用方式為


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

應用程式狀態物件的索引。

傳回

儲存應用程式狀態物件所用的名稱。

範例

下列範例會傳回應用程式狀態集合中所有物件的名稱,並將名稱儲存在字串陣列中。

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

適用於