SessionStateItemCollection Constructor
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.
Creates a new, empty SessionStateItemCollection object.
public:
SessionStateItemCollection();
public SessionStateItemCollection ();
Public Sub New ()
Examples
The following code example creates a new SessionStateItemCollection object and sets and gets values in the collection by name.
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
Remarks
The SessionStateItemCollection class is used to manage session-state variable values indexed by a variable name or by numerical index. The session-state variables are exposed to ASP.NET application code using the HttpSessionState class, which is accessed using the Session property of the current HttpContext or the Page. The HttpSessionState class calls the HttpSessionStateContainer class, which manages session-state variable values using the SessionStateItemCollection collection.
Applies to
See also
Feedback
https://aka.ms/ContentUserFeedback.
Bald verfügbar: Im Laufe des Jahres 2024 werden wir GitHub-Issues stufenweise als Feedbackmechanismus für Inhalte abbauen und durch ein neues Feedbacksystem ersetzen. Weitere Informationen finden Sie unterFeedback senden und anzeigen für