Possible Duplicate:
What are the benefits to using a partial class as opposed to an abstract one?
what is the use of creating a partial class in C#.
what could be the possible drawbacks of it.
Possible Duplicate:
What are the benefits to using a partial class as opposed to an abstract one?
what is the use of creating a partial class in C#.
what could be the possible drawbacks of it.
Partial classes are commonly used by Visual Studio Designers. Such as for example the Entity Framework designer, the WinForms, WPF and ASP.NET designers. It always generates partial classes so that you could later add properties and methods to to this partial class and implement some custom functionality that was not available in the initial autogenerated class definition by the designer.
what could be the possible drawbacks of it.
Since the definition of a class could now be split among different .cs
files a developer reading the source code no longer knows where are all the bits of this class. The definition of the class is no longer centralized in a single file but it could exploded all over the same project. So basically you could end up in a hell of a mess if you start abusing with partial classes.
Partial classes are used in technologies like WPF, Silverlight etc. In those cases classes are made partial to separate the design of the application and the code related to its functionality. In Windows Forms, Visual Studio generates the design code part automatically (given the design user submitted with UI designer tools). In WPF XAMLs are also compiled to partial classes on the fly.
Partial classes are used to be able to split the definition of a class. This means that you can define a class across multiple files or in multiple sections of a file. It is most commonly used by the .NET framework itself to seperate auto generated code from user code, as you can see in WinForms, etc.
There aren't really any drawbacks in using partial classes, given that you've had an clear reason to actually start using them, which isn't that common.