Answer: With partial, we can physically separate a class into multiple files.
It is true that Partial Class is used in auto code generation, one use can be maintaining a large class file which might have thousand lines of code. The class might end up with 10 thousand lines and we don't want to create a new class with different name.
public partial class Product
{
// 20 business logic embedded in methods and properties..
}
public partial class Product
{
// another 30 business logic embedded in methods and properties..
}
//finally compile with product.class file.
Another possible use could be that more than one developer can work on the same class as they are stored at different places.
Asked In: Many Interviews |
Alert Moderator