SessionStateItemCollection.GetEnumerator Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Returns an enumerator that can be used to read all the key names in the collection.
public:
override System::Collections::IEnumerator ^ GetEnumerator();
public override System.Collections.IEnumerator GetEnumerator ();
override this.GetEnumerator : unit -> System.Collections.IEnumerator
Public Overrides Function GetEnumerator () As IEnumerator
Returns
An IEnumerator that can iterate through the variable names in the session-state collection.
Implements
Examples
The following code example gets the variable names in a SessionStateItemCollection collection using the GetEnumerator method.
SessionStateItemCollection items = new SessionStateItemCollection();
items["LastName"] = "Wilson";
items["FirstName"] = "Dan";
foreach (string s in items.Keys)
Response.Write("items[\"" + s + "\"] = " + items[s].ToString() + "<br />");
Dim items As SessionStateItemCollection = New SessionStateItemCollection()
items("LastName") = "Wilson"
items("FirstName") = "Dan"
For Each s As String In items.Keys
Response.Write("items(""" & s & """) = " & items(s).ToString() & "<br />")
Next
Applies to
See also
Werk met ons samen op GitHub
De bron voor deze inhoud vindt u op GitHub, waar u ook problemen en pull-aanvragen kunt maken en bekijken. Raadpleeg onze gids voor inzenders voor meer informatie.