I read about partial classes and, for example, I understand the reason for they are used when Visual Studio creates Windows Forms, without ruling out that
when working on large projects, spreading a class over separate files
enables multiple programmers to work on it at the same time
.
Later I read this example and I noticed that most of the classes are declared as partial. Why?
Partial classes allow code to not only add to the generated classes, but also implement optional functionality.
For example, there may be generated code which performs property validation (through IDataErrorInfo) but the validation on each property cannot be determined at generation time, the partial class allows the developer to specify the validation at a later point.
The generated file:
The developer implemented file: