Пример #1
0
 public static byte[] SerializeUser(SEC_User user)
 {
     System.Runtime.Serialization.Formatters.Binary.BinaryFormatter binary = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();
     System.IO.MemoryStream memStream = new System.IO.MemoryStream();
     binary.Serialize(memStream, user);
     return(memStream.ToArray());
 }
Пример #2
0
        public static SEC_User DeSerializeUser(byte[] data)
        {
            System.IO.MemoryStream memStream = new System.IO.MemoryStream(data);
            memStream.Position = 0;
            System.Runtime.Serialization.Formatters.Binary.BinaryFormatter binary = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();
            SEC_User newobj = binary.Deserialize(memStream) as SEC_User;

            memStream.Close();
            return(newobj);
        }