Пример #1
0
        private void btnSerializeArray_Click(object sender, EventArgs e)
        {
            Person pers = new Person(txtFirstName.Text, txtLastName.Text);

            string strMessage = string.Format("File {0} not found.  Deserialization did not succeed!", fileName);

            //Break down pers into bytes - Serialize
            byteArray = BinaryArraySerializer.Serialize(pers);

            if (byteArray != null)
            {
                strMessage = String.Format("{0}, serialized to a series of bytes.   Size = {1}.{2}{3}",
                                           pers.ToString(), byteArray.Length, Environment.NewLine,
                                           "You can now exit application, restart and directly deseialize array!");
            }

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