HttpApplicationState.Item[] 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取对集合中 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
集合中对象的名称。
属性值
由 name. 引用的对象
示例
以下示例返回从MyAppVar1内部HttpApplicationState对象的集合中命名Application的对象,并将其复制到新的对象变量。
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
集合中对象的数值索引。
属性值
由 index. 引用的对象
示例
以下示例从 HttpApplicationState 内部 Application 对象的集合中返回第一个对象(index = 0),并将其复制到新的对象变量。
Object MyObject;
MyObject = Application[0];
Dim MyObject As Object
MyObject = Application(0)