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
.NET
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기