HttpApplicationState.Item[] 屬性

定義

存取 HttpApplicationState 集合中的物件。Gets access to an object in an HttpApplicationState collection. 這個屬性被多載,以允許用名稱或數值索引來存取物件。This property is overloaded to allow access to an object by name or numerical index.

多載

Item[String]

以名稱取得單一 HttpApplicationState 物件的值。Gets the value of a single HttpApplicationState object by name.

Item[Int32]

以索引取得單一 HttpApplicationState 物件。Gets a single HttpApplicationState object by index.

Item[String]

以名稱取得單一 HttpApplicationState 物件的值。Gets the value of a single HttpApplicationState object by name.

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

集合中的物件名稱。The name of the object in the collection.

屬性值

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.

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

適用於

Item[Int32]

以索引取得單一 HttpApplicationState 物件。Gets a single HttpApplicationState object by index.

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

集合中物件的數值索引。The numerical index of the object in the collection.

屬性值

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[0];
Dim MyObject As Object
MyObject = Application(0)   

適用於