blog

Home / DeveloperSection / Blogs / Partial Class in .NET

Partial Class in .NET

Uttam Misra3454 21-Dec-2010

In the earlier versions of Visual Studio .Net 2005, while you create an ASP.Net application, you might have seen that a single class has to be in a single file. You will be beginning a class and ending that class in the same file. It was not possible to split a single class across multiple files. This new feature, partial class, allows you to allot different developers to develop the code for different functionalities that are available in a single class. These functionalities can be developed in partial classes and then compiled to form the required assembly.

All the partial definitions must proceed with the key word "Partial".

Benefit of partial classes:

 

1) More than one developer can simultaneously write the code for the class.

 

2) You can easily write your code for a VS.NET generated class.

 

public partial class EmployeeRecord 
{
    public void EmployeeData()
    {
    }
}
 
public partial class EmployeeRecord
{
    public void EmployeeLeave()
    {
    }
}

 


Updated 18-Sep-2014
More than 18 years of working experience in IT sector. We are here to serve you best.

Leave Comment

Comments

Liked By