It's declared partial because VS.NET will put "designer" code into a seperate .cs file that is actually, at compile time, part of the same class.
If you have a Form1.cs you should also have a Form1.Designer.cs on the file system as well. When you drop controls onto a form VS.NET will add code into that designer file. It's seperate because you don't want to see or touch that code, and don't want it getting in the way of your own code.
So, the partial class feature in C# is mainly there to allow the seperation of your code and designer code. At compile time the two (or more) files making up the partial class become a single class - at runtime there isn't any difference between a class defined as partial and one that isn't.
"Back in the day" before partial existed all the designer code was lumped in with your own, and this made for messy .cs files and the possibility of developers changing code that VS.NET was expecting to have exclusive rights to. So, a Form will work fine (if written without designer support) without being partial (e.g. if you were generating the entire file yourself from a T4 template).
Why would you want to remove the "partial"?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With