IHttpSessionState.Item[] 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得或設定個別會話狀態的項目值。
多載
| 名稱 | Description |
|---|---|
| Item[Int32] |
透過數值索引取得或設定會話狀態項目值。 |
| Item[String] |
透過名稱取得或設定會話狀態項目值。 |
Item[Int32]
透過數值索引取得或設定會話狀態項目值。
public:
property System::Object ^ default[int] { System::Object ^ get(int index); void set(int index, System::Object ^ value); };
public object this[int index] { get; set; }
member this.Item(int) : obj with get, set
Default Public Property Item(index As Integer) As Object
參數
- index
- Int32
會話狀態項目值的數值索引。
屬性值
參數中 index 指定的會話狀態項目值。
範例
以下程式碼範例實 Item[] 作了介面的 IHttpSessionState 特性,透過數字索引儲存並回傳內部字典會話狀態項目值。
public object this[int index]
{
get { return pSessionItems[index]; }
set { pSessionItems[index] = value; }
}
Public Property Item(index As Integer) As Object Implements IHttpSessionState.Item
Get
Return pSessionItems(index)
End Get
Set
pSessionItems(index) = value
End Set
End Property
另請參閱
適用於
Item[String]
透過名稱取得或設定會話狀態項目值。
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 指定的會話狀態項目值。
範例
以下程式碼範例實 Item[] 作了介面的 IHttpSessionState 特性,即透過字典的鍵名儲存並回傳內部字典會話狀態項目值。
public object this[string name]
{
get { return pSessionItems[name]; }
set { pSessionItems[name] = value; }
}
Public Property Item(name As String) As Object Implements IHttpSessionState.Item
Get
Return pSessionItems(name)
End Get
Set
pSessionItems(name) = value
End Set
End Property