CSharp examples for System:Byte Array
Object To Byte Array To Self
using System.Runtime.Serialization; using System.Runtime.Serialization.Formatters.Binary; using System.IO.Compression; using System.IO;//from ww w .jav a 2 s.c o m using System.Data; using System; public class Main{ private static byte[] ObjectToByteArrayToSelf(object o) { MemoryStream stream = new MemoryStream(); new DataContractSerializer(o.GetType()).WriteObject(stream, o); byte[] buffer = stream.ToArray(); stream.Close(); return buffer; } }