HttpApplicationState.Item[] 屬性

定義

存取 HttpApplicationState 集合中的物件。 這個屬性被多載,以允許用名稱或數值索引來存取物件。

多載

Item[String]

以名稱取得單一 HttpApplicationState 物件的值。

Item[Int32]

以索引取得單一 HttpApplicationState 物件。

Item[String]

以名稱取得單一 HttpApplicationState 物件的值。

public:
 property System::Object ^ default[System::String ^] { System::Object ^ get(System::String ^ name); void set(System::String ^ name, System::Object ^ value); };
public object this[string name] { get; set; }
member this.Item(string) : obj with get, set
Default Public Property Item(name As String) As Object

參數

name
String

集合中的物件名稱。

屬性值

Object

name 所參考的物件。

範例

下列範例會從 HttpApplicationState 內部 Application 物件的集合傳回名為 MyAppVar1 的物件,並將它複製到新的物件變數。

Object MyObject;
MyObject = Application["MyAppVar1"];
Dim MyObject As Object
MyObject = Application("MyAppVar1")

適用於

Item[Int32]

以索引取得單一 HttpApplicationState 物件。

public:
 property System::Object ^ default[int] { System::Object ^ get(int index); };
public object this[int index] { get; }
member this.Item(int) : obj
Default Public ReadOnly Property Item(index As Integer) As Object

參數

index
Int32

集合中物件的數值索引。

屬性值

Object

index 所參考的物件。

範例

下列範例會從 HttpApplicationState 內部 Application 物件的集合傳回第一個物件 (index = 0) ,並將它複製到新的物件變數。

Object MyObject;
MyObject = Application[0];
Dim MyObject As Object
MyObject = Application(0)

適用於