ISessionStateItemCollection.Item[] Proprietà

Definizione

Ottiene o imposta un valore nell'insieme.

Overload

Item[Int32]

Ottiene o imposta un valore nell'insieme in base all'indice numerico.

Item[String]

Ottiene o imposta un valore nell'insieme in base al nome.

Item[Int32]

Ottiene o imposta un valore nell'insieme in base all'indice numerico.

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

Parametri

index
Int32

Indice numerico del valore nell'insieme.

Valore della proprietà

Object

Il valore dell'insieme archiviato nell'indice specificato.

Esempio

Nell'esempio Item[Int32] di codice seguente viene illustrata un'implementazione della proprietà che usa un SortedList oggetto per archiviare i nomi e i valori delle variabili di sessione. Per un esempio di implementazione completa dell'interfaccia ISessionStateItemCollection , vedere l'esempio fornito nella panoramica dell'interfaccia ISessionStateItemCollection .

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

Vedi anche

Si applica a

Item[String]

Ottiene o imposta un valore nell'insieme in base al nome.

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

Parametri

name
String

Nome di chiave del valore nell'insieme.

Valore della proprietà

Object

Il valore dell'insieme con il nome specificato.

Esempio

Nell'esempio Item[String] di codice seguente viene illustrata un'implementazione della proprietà che usa un SortedList oggetto per archiviare i nomi e i valori delle variabili di sessione. Per un esempio di implementazione completa dell'interfaccia ISessionStateItemCollection , vedere l'esempio fornito nella panoramica dell'interfaccia ISessionStateItemCollection .

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

Vedi anche

Si applica a