Rajesh Bathala
Answered On : Jun 13th, 2007
Partial class allows developers to split a class into multiple files.
ex:
public partial class A
{
A()
{
//constructor here
}
}
Suppose another developer needs to add a new function to it called updated A , the other developer can creat a new file call it A1.cs and it should be look something like this.
public partial cllass A
{
public void update A()
{
// function code goes here
}
}
while using partial classes ,if we have declared a constructor or a function in one source file, we can not define the same in the other partial source file.
The .NET runtime executes these two classes it treats two or multiple source file as one single class A.
Regards
Rajesh Bathala

2 Users have rated as useful.
Login to rate this answer.
Partial class is to split the class into multiple files
Login to rate this answer.