예제 #1
0
        protected Licenses Deserialize(byte[] serializedObject)
        {
            Stream          str      = new MemoryStream(serializedObject);
            BinaryFormatter formater = new BinaryFormatter();
            Licenses        set      = null;

            try
            {
                set = (formater.Deserialize(str) as Licenses);
            }
            catch (Exception)
            {
                return(null);
            }
            return(set);
        }
예제 #2
0
        public byte[] Serialize(Licenses set)
        {
            Stream          str      = new MemoryStream();
            BinaryFormatter formater = new BinaryFormatter();

            try
            {
                formater.Serialize(str, set);
            }
            catch (Exception)
            {
                return(null);
            }

            byte[] ret = new byte[str.Length];
            str.Position = 0;
            str.Read(ret, 0, Convert.ToInt32(str.Length));

            return(ret);
        }