I wonder why the concept of a "partial class" exists even in C # / VB.NET. I am working on an application, and we are reading a (actually very good) book that matches the development platform that we implement at work. In the book, the author provides a large code base / wrapper around the platform APIs and explains how he developed it by studying various topics of platform development.
In any case, the long story is short - it uses partial classes throughout as a way to fake multiple inheritance in C # (IMO). Why didn’t he just divide the classes into several, but the use of composition outside of me. It will have 3 'partial class files to compose its base class, each of which contains 3-500 lines of code ... And it does this several times in its API.
Do you find it warranted? If it were me, I would follow SRP and create several classes to handle the various required behaviors, and then create a base class that has instances of these classes as members (e.g. composition). Why did MS even include a partial class in the framework? They removed the ability to expand / collapse all the code at each level in C # (this was allowed in C ++), because it obviously just allowed us to use bad habits - a partial class, IMO, the same thing. I think my question is: can you explain to me when there will be a legitimate reason to ever use a partial class?
EDIT: I know there is no other choice for Web / WinForms. But beyond that? Why didn't MS just add a few keywords to glue the code? Or is there really a suitable design scenario?
I do not mean that it is a battle / war. I honestly want to know something here. When should partial classes be used in code development? Simple question, no need to close
thank
dferraro Mar 19 '10 at 14:01 2010-03-19 14:01
source share