Hi friends,
I want know what is partial class in C#?
thank you.
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Jignesh TrivediPosted May 7, 2012, 11:35 PM
Partial class is a new feature added to C# 2.0. Partial classes span multiple files.
It is possible to split the definition of a class or a struct, or an interface over two or more source files. Each source file contains a section of the class definition, and all parts are combined when the application is compiled.
When working on large projects, spreading a class over separate files allows multiple programmers to work on it simultaneously.
example:
File1.cs
public partial class Employee
{
public void DoWork()
{
}
}
file2.cs
public partial class Employee
{
public void GoToLunch()
{
}
}
please refer
http://msdn.microsoft.com/en-us/library/x9fsa0sw.aspx
hope this help.
SenthilkumarPosted May 7, 2012, 10:59 PM
The Partial class concept has introduced in visual studio 2005 onwards. A class can be divided into multiple class, which will be compiled as single class at the time of execution. The physical group of files which has the same name with partial keyword will be combined logically at the execution time.
It allows the large files can be divide into multiple files. All the variables and methods can be called across the partial pages.
A different developers can work on different files.
For example,
Satyapriya NayakPosted May 7, 2012, 9:46 PM
Please refer the below links
http://www.c-sharpcorner.com/uploadfile/puranindia/partial-classes-in-C-Sharp/default.aspx
http://www.c-sharpcorner.com/uploadfile/abhikumarvatsa/partial-classes-in-C-Sharp/default.aspx
http://www.dotnetperls.com/partial
http://msdn.microsoft.com/en-us/library/wa80x488%28v=vs.80%29.aspx
http://www.devx.com/dotnet/Article/22603
Thanks