What is partial class ?
When working on large projects, spreading a class over separate physical files enables multiple developers to work on it at the same time. Partial classes allow for a single Class file to be split up across multiple physical files, and all parts are combined when the application is compiled.
Entaire Class definition in one file (billing.cs).
Same class in the above code split across multiple files.
The biggest use of partial classes is that using Partial Classes multiple programmers can work on the same class easily. Partial classes are mainly used by code generator because the code can be added to the class without having to recreate the source file. Moreover, it's easier to categorize code with partial classes.
Consider the following points while implementing the partial classes:
The partial keyword indicates that other parts of the class can be defined in the same namespace. All the parts should use the partial keyword. All the parts should be available at compile time to form the final type. All the parts should have the same accessibility, such as public, private, and so on.
If you inherit a class or interface on a partial class, then it should be inherited on all parts of a partial class. If a part of the partial class is sealed , then the entire class will be sealed. Also if a part of the partial class is abstract, then the entire class will be an abstract class.