Skip to content

Partial Classes

Allows the splitting of a single class definition over multiple files or sections in the same file.

csharp
public partial class MyClass
{
    public void MethodOne() { /*...*/ }
}

public partial class MyClass
{
    public void MethodTwo() { /*...*/ }
}

Hint: Many .NET frameworks, such as Blazor or ASP.NET Core make use of the partial keyword.