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
Backup And Maintenance Software – Jan 2013
iPad Therapy (Part 3)
Programming WCF : Queued Services - Transactions
Smart Phones, Smart Savings (Part 3)
Sharp Aquos LC32LE340M : Just Enough
Windows Server 2008 : Install the Hyper-V Role
My ipad : Presentations with Keynote - Playing Your Presentation, Using the VGA Adapter
SQL Server 2005 Data Protection
iPhone Application Development : Implementing a Custom Picker View (part 1)
Say Hello To iPhone 5!
Top 10
ADO.NET Programming : Microsoft SQL Server (part 4) - Working with Typed Data Sets
ADO.NET Programming : Microsoft SQL Server (part 3) - Using Stored Procedures with DataSet Objects
ADO.NET Programming : Microsoft SQL Server (part 2) - Using SQL Server Stored Procedures
ADO.NET Programming : Microsoft SQL Server (part 1) - Connecting to SQL Server, Creating Command Objects
Windows Phone 8 In-Depth Review (Part 6)
Windows Phone 8 In-Depth Review (Part 5)
Windows Phone 8 In-Depth Review (Part 4)
Windows Phone 8 In-Depth Review (Part 3)
Windows Phone 8 In-Depth Review (Part 2)
Windows Phone 8 In-Depth Review (Part 1)