What is Partial Class ? How we can implement in C#.net applications.
Please send me with one example
Join the conversation! Your thoughts help the community grow.
Sign in to leave a comment
It is the same account you read, post and publish with — and you will come straight back to this page.
What is Partial Class ? How we can implement in C#.net applications.
Please send me with one example
Gajendra kumarPosted Jun 13, 2007, 12:56 AM
Hi Sarangi, partial classes mean that your class definition can be split into multiple physical file. using System; partial class XY { int x; public int X { get { return x; } set { x = value; } } } partial class XY { int y; public int Y { get { return y; } set { y = value; } } } class MainClass { public static void Main() { XY xy = new XY(); Console.WriteLine(xy.X + "," + xy.Y); } } partial classes allow you to split the definition of a class into multiple files, you cannot mix languages. Following are live example: They allow programmers on your team to work on different parts of a class without needing to share the same physical file. While this is useful for projects that involve big class files, be wary: If you find your class file getting too large, it may well signal a design fault and refactoring may be required. The most compelling reason for using partial class is to separate your application business logic from the designer-generated code. For example, the code generated by Visual Studio 2005 for a Windows Form is kept separate from your business logic (we will discuss this in a later section). This will prevent developers from messing with the code that is used for the UI. At the same time, it will prevent you from losing your changes to the designer-generated code when you change the UI. I hope now you have no confusion regarding partial class.