Partial Classes and Methods

Learn how to split class and method definitions across multiple files using the partial keyword to organize code and support source generation.

C# allows us to split a class definition across multiple files using the partial keyword. This informs the compiler that the type definition spans several source files.

Define partial classes

Let’s look at how we can define the properties of a Person class in one file.