[Mono-list] Mixing languages within
Jonathan Pryor
jonpryor@vt.edu
Sun, 12 Dec 2004 09:02:03 -0500
On Fri, 2004-12-10 at 14:30 +0000, Colin JN Breame wrote:
> Jonathan Gilbert wrote:
>
> >Not exactly right. You're leaving out an intermediate step: an individual
> >source code file can be compiled to a .netmodule, and .netmodules compiled
> >with different languages can be mixed within a single assembly.
>
> Does this mean that a partial class (or part of a class) can be compiled
> to a .netmodule? or do .netmodules have to contain a complete class?
A partial class is a language feature, not an IL feature. The language
compiler is responsible for merging all partial classes together into a
single IL class.
Consequently, you can't have part of a partial class in C# and another
part in VB.NET. All parts must be in the same language.
(Note: the parts must be in the same language *at compile time*. XAML
uses partial classes where one of the parts is generated from an XML
file, but the XAML engine is responsible for converting the XML into the
appropriate language before they're compiled together.)
- Jon