CSharp examples for System.IO:BinaryWriter
Binary Writer Serialize
using System.Text; using System.Runtime.Serialization.Formatters.Binary; using System.IO;/*from ww w . j av a 2s . co m*/ using System.Globalization; using System; public class Main{ public static void Serialize(BinaryWriter binaryWriter, object objectToSend) { BinaryFormatter binaryFormatter = new BinaryFormatter(); binaryFormatter.Serialize(binaryWriter.BaseStream, objectToSend); } public static void Serialize(Stream stream, object objectToSend) { BinaryFormatter binaryFormatter = new BinaryFormatter(); binaryFormatter.Serialize(stream, objectToSend); } }