public partial class Form1 : Form
What does the partial in this declaration mean? I understand we have a class Form1 that inherits from Form. But what does the partial mean?
public partial class Form1 : Form
What does the partial in this declaration mean? I understand we have a class Form1 that inherits from Form. But what does the partial mean?
It allows you to split the definition of your class into two or more separate files.
See this MSDN article, "Partial Class Definitions" for more information:
You're likely referring to the default behavior of Visual Studio when creating forms. This allows the definition of the form to be split between the file that you own and can modify, and the file that Visual Studio owns (Form1.Designer.cs). This avoids a lot of headaches we saw with Visual Studio 2002 and 2003, when the developer and the IDE would step over each other's toes all the time with their edits.
This permits partial class definitions in source files which are combined into a single class at compilation. In your case one half of the class code is autogenerated by the code generator and hidden from you in a file with partial class declaration (there will be a lot of code in there). You are given a clean slate with partial class definition to allow you to enter code in this partial definition so at compilation the autogenerated code and your code are combined into a single class derived from the class Form. Its a commone way of of combining the machine's and the man's code in visual designers etc to allow you to not write the plumbing boring code and just concentrate on what you will like to do.