Introduction
A Partial class is one that can be split among multiple physical files. This feature was introduced with the release of C# version 2.0. With C#.
we can split the source code for a class into separate files so that we can organize the definition of a large class into smaller, easier-to-manage pieces. When we split a class across multiple files, we define the parts of the class by using the partial keyword in each file. Each file contains a section of the class definition, and all parts are combined when the application is compiled. Look at the example below/
Calculation. cs
// Calculation1.cs
partial class ClassRoom
{
private int boycount; // field
public ClassRoom() // default constructor
{
boycount = 30;
}
}
// Calculation2.cs
partial class ClassRoom
{
public ClassRoom(int bcount) // overloaded constructor
{
boycount = bcount;
}
public double Avg() // method
{
// statements go here
}
}Now, when we compile a class that has been split into separate files, we must provide all the files to the compiler.
Partial Classes Rules and Advantages
To work on large projects, spreading a class over separate files allows multiple programmers to work on it simultaneously.
When working with an automatically generated source, code can be added to the class without having to recreate the source file.
To split a class definition, use the partial keyword modifier.
All the parts must have the same accessibility, such as public, private, and so on.
The partial modifier can only appear immediately before the keywords class, struct, or interface.
Further Reading: http://en.wikipedia.org/wiki/Partial_class


Bruno PétersonPosted Jun 28, 2015, 2:02 AM EDT
Good one
Subba Rao PasumarthiPosted May 31, 2015, 10:49 PM EDT
Is it possible to create the constructor in all files of partial class ?
Upendra Pratap ShahiPosted May 30, 2015, 9:27 PM EDT
Your welcome....
Santhakumar MunuswamyPosted May 30, 2015, 8:46 AM EDT
Thanks for nice one
NitinPosted May 30, 2015, 7:01 AM EDT
Good one
Sibeesh VenuTOP 100Posted May 29, 2015, 3:27 AM EDT
Nice one.
Pankaj Kumar ChoudharyTOP 100Posted May 29, 2015, 3:20 AM EDT
Nice Article Sir.........
Upendra Pratap ShahiPosted May 29, 2015, 2:08 AM EDT
good article..
Vivek TripathiPosted May 29, 2015, 1:56 AM EDT
good one