[Mono-devel-list] inheriting from System.Delegate - how?

Paolo Molaro lupus at ximian.com
Fri Feb 27 13:25:32 EST 2004


On 02/27/04 Ben Maurer wrote:
> If you need to dynamically construct your delegate type, you must do
> that by using System.Reflection.Emit, which *is* able to emit delegates
> directly (that is what mcs does).
> 
> The document you cited from msdn is actually a statement of Microsoft's
> behavior. There is nobody restricting you from writing a compiler without
> this requirement. However, the fact is, most languages do not do it.

A compiler that emits code can emit anything, of course. This doesn't
mean the code will run. Any class derived directly from System.Delegate
will be rejected by the runtime. Any class derived from
MulticastDelegate must follow the quite strict rules in Partition II of
the ECMA spec or it will be rejected (the rules include the class being
sealed and having a specific set of methods with specific signatures and
flags).

lupus

-- 
-----------------------------------------------------------------
lupus at debian.org                                     debian/rules
lupus at ximian.com                             Monkeys do it better



More information about the Mono-devel-list mailing list