Partial Classes in ASP.NET

Partial class is nothing more then just separation of classes into two or more files. It is done to make sure you can hide complexity from the view and have a clean class where you need it most. The Windows Form class is such an example.

Partial class allows multiple developers to work on the same class at the same time. Compiler then treats it as one single class during compilation time and compiles it into MSIL (Microsoft Intermediate Language) code which is essentially Assembly language coding used to create Assemblies.

There are several benefits of the Partial Classes: business logic can be hidden from user interface which is always good while designing application and debugging becomes easy since you have less code to comb through if you implement partial classes.

PersonFileOne.cs
public partial class Person
{
   public void GetPerson()
   {
       //code
   }
}

PersonFileTwo.cs
public partial class Employee
{
   public void SavePerson ()
   {
       //code
   }
}

class TestPerson
{
 public static void Main(string[] args)
 {
   Person person = new Person();
   person.GetPerson();
   person.SavePerson();
 }
}