Estoy haciendo unas pruebas con un servicio de cache propio en el que guardamos los datos en byte[] en unos diccionarios, así que a quien pueda interesar, aquí os dejo los métodos de serializacion y desserializacion:
public static byte[] ToByteArray(Object obj) { if (obj == null) return null; MemoryStream ms = new MemoryStream(); BinaryFormatter b = new BinaryFormatter(); b.Serialize(ms, obj); byte[] data = ms.ToArray(); ms.Close(); return data; } public static T ToObjectSerialize<T>(byte[] serializedObject) { if (serializedObject == null) return default(T); MemoryStream ms = new MemoryStream(); ms.Write(serializedObject, 0, serializedObject.Length); ms.Seek(0, 0); BinaryFormatter b = new BinaryFormatter(); Object obj = b.Deserialize(ms); ms.Close(); return (T)obj; }



[...] This post was mentioned on Twitter by Emilio Torrens. Emilio Torrens said: Post en the .NET way: Objetos 2 byte[] http://cli.gs/X9EED [...]