HttpApplicationState.Get 方法

定義

以名稱或索引取得 HttpApplicationState 物件。Gets an HttpApplicationState object by name or index.

多載

Get(Int32)

以數值索引取得 HttpApplicationState 物件。Gets an HttpApplicationState object by numerical index.

Get(String)

依名稱取得 HttpApplicationState 物件。Gets an HttpApplicationState object by name.

Get(Int32)

以數值索引取得 HttpApplicationState 物件。Gets an HttpApplicationState object by numerical index.

public:
 System::Object ^ Get(int index);
public object Get (int index);
member this.Get : int -> obj
Public Function Get (index As Integer) As Object

參數

index
Int32

應用程式狀態物件的索引。The index of the application state object.

傳回

Object

index 所參考的物件。The object referenced by index.

範例

下列範例會從內建物件的集合中,傳回 (index = 0) 的第一個物件 HttpApplicationState Application ,並將它複製到新的物件變數。The following example returns the first object (index = 0) from the HttpApplicationState collection of the intrinsic Application object and copies it to a new object variable.

Object MyObject;
MyObject = Application.Get(0);

Dim MyObject As Object
MyObject = Application.Get(0)

適用於

Get(String)

依名稱取得 HttpApplicationState 物件。Gets an HttpApplicationState object by name.

public:
 System::Object ^ Get(System::String ^ name);
public object Get (string name);
member this.Get : string -> obj
Public Function Get (name As String) As Object

參數

name
String

物件的名稱。The name of the object.

傳回

Object

name 所參考的物件。The object referenced by name.

備註

下列範例會從內建物件的集合傳回名為 MyAppVar1 的物件 HttpApplicationState Application ,並將它複製到新的物件變數。The following example returns an object named MyAppVar1 from the HttpApplicationState collection of the intrinsic Application object and copies it to a new object variable.

Dim MyObject As Object  
MyObject = Application.Get("MyAppVar1")  
Object MyObject;  
MyObject = Application.Get("MyAppVar1");  

適用於