title: Datapoint Serialization
body: <p>How can I only serializable DataPoints? I want save DataPoints to a file.</p>
  
  <pre><code>[Serializable]
  class CIE
  {
    public List&lt;DataPoint&gt; CieDataPoint = new List&lt;DataPoint&gt;() ;
  }
  List&lt;DataPoint&gt; GetCieColorPoints(string filename, int count)
  {
          CIE cie = new CIE();
          var data = new List&lt;DataPoint&gt;();
  
          float cr = (float)Math.Sqrt(count);
          using (Bitmap bmp = new Bitmap(filename))
          {
              int sx = (int)(bmp.Width / cr);
              int sy = (int)(bmp.Height / cr);
  
              float scx = 0.8f / bmp.Width;
              float scy = 0.9f / bmp.Height;
  
              for (int x = 0; x &lt; bmp.Width; x += sx)
                  for (int y = 0; y &lt; bmp.Height; y += sy)
                  {
                      Color c = bmp.GetPixel(x, y);
                      float b = c.GetBrightness();
                      if (b &gt; 0.01f &amp;&amp; b &lt; 0.99f)
                      {
                          var dp = new DataPoint(x * scx, 0.9f - y * scy);
                          dp.Color = c;                        
                          dp.MarkerColor = dp.Color;
                          dp.MarkerStyle = MarkerStyle.Circle ;
                          data.Add(dp);
                      }
                  }
          }  
          return data;
      }
  
  Cie.CieDataPoint = GetCieColorPoints("E:\\CIExy1931_T2.png", 125000);;
  IFormatter formatter = new BinaryFormatter();
  FileStream seryalization = new FileStream("CIEdata", FileMode.Create, FileAccess.Write);
  formatter.Serialize(seryalization, Cie);
  seryalization.Close();
  </code></pre>
  
  <p>Error 
  Additional information: Type 'System.Windows.Forms.DataVisualization.Charting.DataPoint' in Assembly 'System.Windows.Forms.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' is not marked as serializable.     </p>