Exemplo n.º 1
0
        protected static Event createEvent(ref byte[] b)
        {
            //get name of class
            MemoryStream ms        = new MemoryStream(b);
            BinaryReader reader    = new BinaryReader(ms);
            int          size      = reader.ReadInt32();
            String       className = reader.ReadString();

            //create an instance of object
            Type  t = Type.GetType(className);
            Event e = (Event)Activator.CreateInstance(t);

            //reset the stream so that it deserializes from the beginning
            ms.Seek(0, 0);

            //fill it in
            e.deserialize(ref reader);

            return(e);
        }