title: Getting Serializable Error Even After Inserting [Serializable] Before Class
body: <p>I created a class</p>
  
  <pre><code>[Serializable]
  public class clsCategories
  {
      public static List&lt;infoCategories&gt; listCategories = new List&lt;infoCategories&gt;();
      public void serialize()
      {
          BinaryFormatter bf = new BinaryFormatter();
          FileStream fs = new FileStream("categories.dat", FileMode.Create);
          bf.Serialize(fs, listCategories);
          fs.Close();
      }
  
      [Serializable]
      public class infoCategories
      {
          public PictureBox img { get; set; }
          public Label lbl { get; set; }
      }
  }
  </code></pre>
  
  <p>Now when calling this method...</p>
  
  <pre><code> private void btnDone_Click(object sender, EventArgs e)
   {
       objCategories.serialize();
       this.Hide();
   }
  </code></pre>
  
  <p>I got this error: </p>
  
  <blockquote>
    <p>An unhandled exception of type
    'System.Runtime.Serialization.SerializationException' occurred in
    mscorlib.dll</p>
    
    <p>Additional information: Type 'System.Windows.Forms.PictureBox' in
    Assembly 'System.Windows.Forms, Version=2.0.0.0, Culture=neutral,
    PublicKeyToken=b77a5c561934e089' is not marked as serializable.</p>
  </blockquote>
  
  <p>Where am i mistaking?</p>