Home > DeveloperSection > Blogs > Partial Class in .NET

Partial Class in .NET


C# C# 
Ratings:
0 Comment(s)
 1913  View(s)
Rate this:

Partial Class in .NET

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()

    {

    }

}

 


Don't want to miss updates? Please click the below button!

Follow MindStick