DESKTOP

Serialize to an In-Memory Stream

9/25/2010 3:23:15 PM
Problem : You need to serialize data to a buffer in memory, rather than a network stream or file.

Solution:
The preceding serialization example did this, but I’ll cover it in this section as well.

Serialize Objects Using SerializableAttribute


byte[] bytes = new byte[1024];
using (MemoryStream ms = new MemoryStream(bytes))
{
//write to stream using any method you like that accepts a stream
}
//manipulate the bytes however you want, including converting them to
//text using the Encoding class if the data is textual

Other  
 
Most View
-  Samsung Home Theatre Series With Wireless Connection
-  MSI GT70 Notebook - Power Play
-  Compact Cameras For The Dynamic
-  Review: lcy Box Stand For iPad
-  Better Than Expected Showing (Part 2)
-  G Data Total Protection 2013 - Innovative Fingerprinting Technique
-  ECS Z77H2-A2X v1.0 - Golden LGA 1155 Mainboard From The Black Series (Part 3)
-  Free VirtualBox Images (Part 2) - Create your own VirtualBox image
-  Improve Your Mac (Part 4) - Tips for saving bandwidth
-  The Modern Office (Part 2)
Top 10
-  Kingston Wi - Drive 128GB: Simple To Get Started
-  Seagate Wireless Plus 1 TB - Streaming Videos To Various Devices
-  Seagate Wireless Plus 1TB - Seagate's Second Wireless External Hard Drive
-  Western Digital My Passport 2TB - The Ideal Companion For Anyone
-  Lenovo IdeaTab A2109 - A Typical Midrange Android Tablet
-  Secret Tips For Your Kindle Fire
-  The Best Experience With Windows 8 Tablets And Hybrids (Part 2)
-  The Best Experience With Windows 8 Tablets And Hybrids (Part 1)
-  Give Your Browser A Health Check
-  New Ways To Block Irritating Ads…