What the intention of the "components" variable?

For every IDE generated UserControl C# file, there are some identical code :

/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;

/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}

However, I can't find any other place that uses components variables. Is it will always be null? What's the intention of this variable?

Thanks!

[792 byte] By [LeiJiang] at [2007-12-16]
# 1
The components variable is used when you drag a non-visible component onto the design surface, such as a Timer, SqlConnection, SaveFileDialog, etc.

It is used to hold components and is responsible for disposing of the components in the Form/UserControl/Other Component.

Without it, the user would manually have to call Dispose on every component the Form/UserControl/Other Component holds.

DavidM.Kean at 2007-9-9 > top of Msdn Tech,Windows Forms,Windows Forms Designer...
# 2
Does this means if I only use visible controls on the design surface, there is no need to declare this "components" variable?

Thanks!

LeiJiang at 2007-9-9 > top of Msdn Tech,Windows Forms,Windows Forms Designer...
# 3
Yea, you can remove it. You just need to remember to add it back if you ever use non-visible components.
DavidM.Kean at 2007-9-9 > top of Msdn Tech,Windows Forms,Windows Forms Designer...
# 4
Thanks!
LeiJiang at 2007-9-9 > top of Msdn Tech,Windows Forms,Windows Forms Designer...