ONJava.com -- The Independent Source for Enterprise Java
oreilly.comSafari Books Online.Conferences.

advertisement

AddThis Social Bookmark Button
Article:
  Making Sense of Partial Classes
Subject:   Can we extend the Class without inheriting an existing class
Date:   2005-01-24 20:47:06
From:   GersonK
Response to: Can we extend the Class without inheriting an existing class

In C# you have to use the "partial" modifier in the class decalaration in both files or it won't compile. So building the class partially is essentially just an implementation detail, hidden from other pieces of code.


In VB.NET, as long as the files are in the same project, only one of them has to use the partial modifier. This seems like an invitation to mischief to me, but here's some defense of it from a member of the VB team :
http://www.panopticoncentral.net/archive/2004/07/13/1403.aspx.
I can't find the promised separate posting explaining why VB.NET and C# behave differently in this area.