[IronPython] Subclassing then instantiating from C#

Curt Hagenlocher curt at hagenlocher.org
Tue Aug 26 22:10:36 CEST 2008


If you say

class Foo(System.Windows.Forms.Control):
    pass

then yes, the CLS type we emit will be derived from Control.  It has to be,
or derivation wouldn't be meaningful.

On Tue, Aug 26, 2008 at 12:01 PM, hellosticky <hellosticky at gmail.com> wrote:

>  Would the emitted CLS type subclass my class?
> I think I will go toward the DLR hosting model instead...
> Thanks,
>
>  ------------------------------
> *From:* Curt Hagenlocher [mailto:curt at hagenlocher.org]
> *Sent:* Tuesday, August 26, 2008 2:48 PM
> *To:* hellosticky at gmail.com; Discussion of IronPython
> *Subject:* Re: [IronPython] Subclassing then instantiating from C#
>
>    This isn't really a supported scenario today.  There is a CLS type
> emitted for your class but it's emitted at runtime.  See also
> http://blogs.msdn.com/shrib/archive/2008/07/24/cls-compilation-of-ironpython.aspx
>
> Before joining the IronPython team, I started a project that would allow
> this operation -- but I haven't been able to put any time into it recently.
>
> On Tue, Aug 26, 2008 at 11:44 AM, hellosticky <hellosticky at gmail.com>wrote:
>
>> Hi, I have a C#.NET DLL that has an abstract class. I subclass this class
>> in IronPython, and then build a DLL using pyc.py. Now, I'd like to load this
>> IronPython Assembly from another C# project, instantiate the class (using
>> something like Assembly.GetType()) and call the virtual method on it.
>>
>> The override of the abstract method worked and the DLL got build, but when
>> I load it in Reflector, I don't see any classes that subclass the original
>> .NET class. Any ideas?
>>
>> Thanks,
>>
>> _______________________________________________
>> Users mailing list
>> Users at lists.ironpython.com
>> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20080826/6249d1be/attachment.html>


More information about the Ironpython-users mailing list