예제 #1
0
        private void btnDeserializeArray_Click(object sender, EventArgs e)
        {
            //Put together the byteArray to a person object

            string strMessage = string.Format("No byte array in memory. Deserialization cannot continue!");

            if (byteArray != null)
            {
                Person pers = BinaryArraySerializer.Deserialize <Person>(byteArray);

                if (pers != null)
                {
                    strMessage = string.Format("{0},{2} From an array of 0:s and 1:s back as a Person.{2}Size of array = {1}.{2}{2} Teleportation works now!",
                                               pers.ToString(), byteArray.Length, Environment.NewLine);

                    txtFirstName.Text = pers.FirstName.ToUpper();
                    txtLastName.Text  = pers.LastName.ToUpper();
                }
            }

            lblMessage.Text = strMessage;
            timer1.Enabled  = true;
        }