allow us to split a class into 2 or more files - all these parts are then combine into a single class when the application is compiled
Advantages
1. VS uses partial classes to separate automatically generated system code from the developer's code
2. spreading a class over separate files allow multiple programmers to work on it simultaneously
public partial class Customer //using partial keyword - using the class is the same way
{
}
Creating Partial Classes
1. All the parts spread across different files, must use the partial keyword
2. must use the same access modifiers
3. if any of the parts are declared abstract, then the entire type is considered abstract - public abstract partial class ClassName{
4. If any of the parts are declared sealed, then the entire type is considered sealed. - public sealed partial class ClassName{ //can't act base class
5. if any of the parts inherit a class, then the entire type inherits that class
6. Different parts of the partial class, must not specify different base classes
7. different parts of the partial class can specify different bas interfaces, and the final type implements all of the interfaces listed by all of the partial declarations.
8. any members that are declared in a partial definition are available to all of the other parts of the partial class
9. signature of the partial method declaration, must match with the signature of the implementation
10. A partial method must be declared within a partial class or partial struct. A non partial class or struct can't include partial methods.
11. A partial method can be implemented only one. Trying to implement a partial method more than once, raises a compile time error