Subscribe to Subscribers

Online Members

baskar
More...

Forums » .NET » ASP.NET »

what is partial class?


Posted Date: 18 Jan 2008      Posted By:: Ravindra Singh     Member Level: Gold    Member Rank: 1730     Points: 2   Responses: 6



hi all,
in every asp.net code behind page a partial class is added.what is partial class means??
thanks




Responses

#179840    Author: Shanmugam      Member Level: Gold      Member Rank: 0     Date: 18/Jan/2008   Rating: 2 out of 52 out of 5     Points: 2

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.

 
#179842    Author: Harsha      Member Level: Gold      Member Rank: 0     Date: 18/Jan/2008   Rating: 2 out of 52 out of 5     Points: 2

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. There are several situations when splitting a class definition is desirable:

When working on large projects, spreading a class over separate files allows multiple programmers to work on it simultaneously.

public partial class CoOrds
{
private int x;
private int y;

public CoOrds(int x, int y)
{
this.x = x;
this.y = y;
}
}

public partial class CoOrds
{
public void PrintCoOrds()
{
System.Console.WriteLine("CoOrds: {0},{1}", x, y);
}

}

class TestCoOrds
{
static void Main()
{
CoOrds myCoOrds = new CoOrds(10, 15);
myCoOrds.PrintCoOrds();
}
}


 
#179853    Author: Pawan Tiwari      Member Level: Gold      Member Rank: 410     Date: 18/Jan/2008   Rating: 2 out of 52 out of 5     Points: 2

The purpose of partial classes is to allow a class's definition to span across multiple files

Pawan Tiwari
Senior Software engineer
07814140365
My Blog





 
#179868    Author: Dhivya      Member Level: Gold      Member Rank: 0     Date: 18/Jan/2008   Rating: 2 out of 52 out of 5     Points: 2

Partial classes can improve code readability and maintainability by providing a powerful way to extend the behavior of a class and attach functionality to it.

 
#180075    Author: Shiva SaiRam      Member Level: Gold      Member Rank: 186     Date: 18/Jan/2008   Rating: 2 out of 52 out of 5     Points: 2

A Partial class is a class that can be split into two or more classes. This means that a class can be physically separated into other parts of the class within the same namespace. All the parts must use the partial keyword. All the other classes should also have the same access modifier. At the compile time, all the partial classes will be treated as a single class. Let us list some advantages of having partial classes.
• Allows a clean separation of business logic layer and the user interface.
• The UI code can be hidden from the developer.
• Makes the debugging easier.


 
#281449    Author: asdf      Member Level: Silver      Member Rank: 0     Date: 14/Aug/2008   Rating: 2 out of 52 out of 5     Points: 0

• Partial Class
It’s a keyword where classes, struct and interface can use it for span across multiple files like Generating a part of a class SO THAT multiple files can be beneficial.


 
Post Reply

 This thread is locked for new responses. Please post your comments and questions as a separate thread.
If required, refer to the URL of this page in your new post.



Next : very urgent
Previous : Threads in Asp.net
Return to Discussion Forum
Post New Message
Category:

Related Messages

Active Members
TodayLast 7 Daysmore...

Awards & Gifts
Talk to Webmaster Tony John
Copyright © SpiderWorks Technologies Pvt Ltd., Kochi, India
2005 - 2013 All Rights Reserved.
.NET and other trademarks mentioned in this site belong to Microsoft and other respective trademark owners.
Articles, tutorials and all other content offered here is for educational purpose only.
We are not associated with Microsoft or its partners.