編輯

共用方式為


HttpApplicationState.Item[] Property

Definition

Gets access to an object in an HttpApplicationState collection. This property is overloaded to allow access to an object by name or numerical index.

Overloads

Item[String]

Gets the value of a single HttpApplicationState object by name.

Item[Int32]

Gets a single HttpApplicationState object by index.

Item[String]

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

Parameters

name
String

The name of the object in the collection.

Property Value

The object referenced by name.

Examples

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")

Applies to

Item[Int32]

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

Parameters

index
Int32

The numerical index of the object in the collection.

Property Value

The object referenced by index.

Examples

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)

Applies to