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
Above answer was rated as good by the following members:
rambabu_ms
June 13, 2007 05:38:06 #1
Rajesh Bathala
RE: what is the concept of partial class in .net2.0?
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.
Thursday, September 25, 2008
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment