ערוך

שתף באמצעות


ISessionStateItemCollection.Item[] Property

Definition

Gets or sets a value in the collection.

Overloads

Item[Int32]

Gets or sets a value in the collection by numerical index.

Item[String]

Gets or sets a value in the collection by name.

Item[Int32]

Gets or sets a value in the collection by numerical index.

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

Parameters

index
Int32

The numerical index of the value in the collection.

Property Value

The value in the collection stored at the specified index.

Examples

The following code example shows an implementation of the Item[Int32] property that uses a SortedList to store session-variable names and values. For an example of a complete implementation of the ISessionStateItemCollection interface, see the example provided in the ISessionStateItemCollection interface overview.

public object this[int index]
{
  get { return pItems[index]; }
  set
  {
    pItems[index] = value;
    pDirty = true;
  }
}
Public Property Item(index As Integer) As Object Implements ISessionStateItemCollection.Item
  Get
    Return pItems(index)
  End Get
  Set
    pItems(index) = value
    pDirty = True
  End Set
End Property

See also

Applies to

Item[String]

Gets or sets a value in the collection 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 key name of the value in the collection.

Property Value

The value in the collection with the specified name.

Examples

The following code example shows an implementation of the Item[String] property that uses a SortedList to store session-variable names and values. For an example of a complete implementation of the ISessionStateItemCollection interface, see the example provided in the ISessionStateItemCollection interface overview.

public object this[string name]
{
  get { return pItems[name]; }
  set
  {
    pItems[name] = value;
    pDirty = true;
  }
}
Public Property Item(name As String) As Object Implements ISessionStateItemCollection.Item
  Get
    Return pItems(name)
  End Get
  Set
    pItems(name) = value
    pDirty = True
  End Set
End Property

See also

Applies to