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