Partial Class and its uses [Resolved]

Posted by Amatya under C# on 2/12/2016 | Points: 10 | Views : 206 | Status : [Member] | Replies : 4
Good Morning... What is partial class? and why Microsoft has introduced it and where we can use it?

Feel free to share informations 9731764134
mail Id ' adityagupta200@gmail.com
Thanks



Responses

Posted by: Rajnilari2015 on: 2/12/2016 [Member] [Microsoft_MVP] [MVP] Platinum | Points: 50

Up
0
Down

Resolved
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 many 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.

More info: https://msdn.microsoft.com/en-IN/library/wa80x488.aspx

Hope this helps.

--
Thanks & Regards,
RNA Team

Amatya, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Raja on: 2/13/2016 [Member] Starter | Points: 25

Up
0
Down
Great answer Niladri.

Regards,
Raja, USA

Amatya, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Rajnilari2015 on: 2/13/2016 [Member] [Microsoft_MVP] [MVP] Platinum | Points: 25

Up
0
Down
@Raja Sir, thanks

--
Thanks & Regards,
RNA Team

Amatya, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Amatya on: 2/16/2016 [Member] Silver | Points: 25

Up
0
Down
So, it is not worthy in Web based application.. as in web application i have never seen a class which have more than thousand lines of code..

Feel free to share informations 9731764134
mail Id ' adityagupta200@gmail.com
Thanks

Amatya, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response