title: What's the purpose of the components IContainer generated by the Winforms designer?
body: <p>When you create a new form in Visual Studio, the designer generates the following code in the .Designer.cs file:</p>
  
  <pre><code>  /// &lt;summary&gt;
    /// Required designer variable.
    /// &lt;/summary&gt;
    private System.ComponentModel.IContainer components = null;
  
    /// &lt;summary&gt;
    /// Clean up any resources being used.
    /// &lt;/summary&gt;
    /// &lt;param name="disposing"&gt;true if managed resources should be disposed; otherwise, false.&lt;/param&gt;
    protected override void Dispose(bool disposing)
    {
       if (disposing &amp;&amp; (components != null))
       {
          components.Dispose();
       }
       base.Dispose(disposing);
    }
  </code></pre>
  
  <p>What is the purpose of the <code>components</code> variable? My theory is that I should use it for any <code>IDisposable</code> classes my form owns which I create outside of Designer (since <code>Dispose</code> is already being implemented by the Designer).</p>
  
  <p>So, for example, if my form owns a font, I could make sure it gets disposed by adding it to <code>components</code> like this:</p>
  
  <pre><code>  public partial class Form1 : Form
    {
        Font coolFont;
  
        public Form1()
        {
            InitializeComponent();
            this.coolFont = new Font("Comic Sans", 12);
            components.Add(this.coolFont);
        }
    }
  </code></pre>
  
  <p>Is that what it's for? I haven't been able to find any documentation or information about this.</p>