title: marking a WinForms Button as serializable
body: <p>This is my very first program for serialization. </p>
  
  <p>An error occurred when trying to serialize a button control.</p>
  
  <pre><code>public Form1()
  {
       InitializeComponent();
       CheckSerialization();                
       Button btn = btnSerialized;            
  }
  
  public void CheckSerialization()
  {
       Stream write = File.OpenWrite(@"C:\ser.bin");
       BinaryFormatter serial = new BinaryFormatter();
       serial.Serialize(write, btnSerialized);
       write.Close();
  }
  
  private void btnSerialized_Click(object sender, EventArgs e)
  {
       FileStream fs = new FileStream(@"C:\ser.bin",FileMode.Open);
       BinaryFormatter bf= new BinaryFormatter();
       object obj = bf.Deserialize(fs);
       Button button12 = (Button)obj;
       button1 = button12;
       button1.Location = new Point(0, 0);
  }
  </code></pre>
  
  <blockquote>
    <p>Type 'System.Windows.Forms.Button' in Assembly 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' is not marked as serializable.**</p>
  </blockquote>
  
  <p>How do I mark this object as serializable?</p>