What is Partial Class?

 Posted by Arun151969 on 3/13/2009 | Category: C# Interview questions | Views: 13310
Answer:

Partial class

Instead of defining an entire class, you can split the definition into multiple classes by using the partial keyword. When the application is complied, the C# complier will group all the partial classes together and treat them as a single class. There are a couple of good reasons to use partial classes. Programmers can work on different parts of a class without needing to share the same physical file. Also you can separate your application business logic from the designer-generated code.

C#

Public partial class Employee

{
public void DoWork()
{}
}

Public partial class Employee
{
public void GoToLunch()
{}
}


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Posted by: Etechpulse on: 4/4/2014 | Points: 10
very informative.. Thanks.
Have a look at this link http://www.etechpulse.com/2014/04/c-tutorial-about-partial-class-in-c.html

Login to post response

More Interview Questions by Arun151969