SessionStateItemCollection.Serialize(BinaryWriter) 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.
Writes the contents of the collection to a BinaryWriter.
public:
void Serialize(System::IO::BinaryWriter ^ writer);
public void Serialize (System.IO.BinaryWriter writer);
member this.Serialize : System.IO.BinaryWriter -> unit
Public Sub Serialize (writer As BinaryWriter)
Parameters
- writer
- BinaryWriter
The BinaryWriter used to write the serialized collection to a stream or encoded string.
Examples
The following code example creates and populates a SessionStateItemCollection collection and writes the contents to a file using the Serialize method.
SessionStateItemCollection items = new SessionStateItemCollection();
items["LastName"] = "Wilson";
items["FirstName"] = "Dan";
System.IO.BinaryWriter writer = new System.IO.BinaryWriter(
System.IO.File.Open(Server.MapPath("session_collection.bin"), System.IO.FileMode.Create));
items.Serialize(writer);
writer.Close();
Dim items As SessionStateItemCollection = New SessionStateItemCollection()
items("LastName") = "Wilson"
items("FirstName") = "Dan"
Dim writer As System.IO.BinaryWriter = New System.IO.BinaryWriter( _
System.IO.File.Open(Server.MapPath("session_collection.bin"), System.IO.FileMode.Create))
items.Serialize(writer)
writer.Close()
Remarks
The Serialize method can be used to write the contents of a SessionStateItemCollection collection to the session store.
To retrieve a serialized SessionStateItemCollection object from the session store, use the Deserialize method.
Applies to
See also
Pripomienky
https://aka.ms/ContentUserFeedback.
Pripravujeme: V priebehu roka 2024 postupne zrušíme službu Problémy v službe GitHub ako mechanizmus pripomienok týkajúcich sa obsahu a nahradíme ju novým systémom pripomienok. Ďalšie informácie nájdete na stránke:Odoslať a zobraziť pripomienky pre