Deserialization not working on MemoryStream
问题 //Serialize the Object MemoryStream ms = new MemoryStream(); IFormatter formatter = new BinaryFormatter(); formatter.Serialize(ms , ObjectToSerialize); byte[] arrbyte = new byte[ms .Length]; ms.Read(arrbyte , 0, (int)ms .Length); ms.Close(); //Deserialize the Object Stream s = new MemoryStream(arrbyte); s.Position = 0; Object obj = formatter.Deserialize(s);//Throws an Exception s.Close(); If I try to Deserialize with the above way it gives the Exception as 'Binary stream '0' does not contain