[IronPython] .NET attributes for methods

Lukas Cenovsky cenovsky at bakalari.cz
Wed Nov 11 02:36:45 PST 2009


I did change __metaclass__ to ClrMetaclass. See the attached source I 
use for testing - the only difference is to comment/uncomment 
appropriate part in product.py.

The outputs look the same, there are no visible exceptions:

DevHawk:

py> a.root.FindName('listbox1').ItemsSource[0].GetType().GetFields()

=> Array[FieldInfo]((<System.Reflection.RtFieldInfo object at 0x000000000000002B [Double cost]>,

<System.Reflection.RtFieldInfo object at 0x000000000000002C [Int32 quantity]>,

<System.Reflection.RtFieldInfo object at 0x000000000000002D [System.String name]>,

<System.Reflection.RtFieldInfo object at 0x000000000000002E [IronPython.Runtime.Types.PythonType .class]>,

<System.Reflection.RtFieldInfo object at 0x000000000000002F [IronPython.Runtime.PythonDictionary .dict]>,

<System.Reflection.RtFieldInfo object at 0x0000000000000030 [System.Object[] .slots_and_weakref]>))


Shri:

py> a.root.FindName('listbox1').ItemsSource[0].GetType().GetFields()

=> Array[FieldInfo]((<System.Reflection.RtFieldInfo object at 0x000000000000002B [Double cost]>,

<System.Reflection.RtFieldInfo object at 0x000000000000002C [Int32 quantity]>,

<System.Reflection.RtFieldInfo object at 0x000000000000002D [System.String name]>,

<System.Reflection.RtFieldInfo object at 0x000000000000002E [IronPython.Runtime.Types.PythonType .class]>,

<System.Reflection.RtFieldInfo object at 0x000000000000002F [IronPython.Runtime.PythonDictionary .dict]>,

<System.Reflection.RtFieldInfo object at 0x0000000000000030 [System.Object[] .slots_and_weakref]>))


--
-- Lukáš


Shri Borde wrote:
>
> Note that you will have to set __metaclass__ to ClrMetaclass, not 
> ClrTypeMetaclass as in DevHawk's sample. I had changed the name of the 
> type. The old name will cause a NameError, but maybe SL is hiding 
> exceptions. Can you do "o.GetType().GetFields()" and display that on 
> the page to inspect the object and also make sure that no exceptions 
> were thrown?
>
>  
>
> *From:* users-bounces at lists.ironpython.com 
> [mailto:users-bounces at lists.ironpython.com] *On Behalf Of *Lukas Cenovsky
> *Sent:* Tuesday, November 10, 2009 2:59 PM
> *To:* Discussion of IronPython
> *Subject:* Re: [IronPython] .NET attributes for methods
>
>  
>
> I have just found that the Silverlight binding does not work with this 
> version of clrtype and/or IronPython 2.6RC2.
> I used DevHawk demo [1] and after I added reference to 
> Microsoft.Dynamic in clrtypemetaclass.py it worked flawlessly. But 
> when I switch to your version, no items show in the listbox.
>
> By the way - I have seen a commit message you have added support for 
> interfaces - nice! ;-)
>
> --
> -- Lukáš
>
> [1] 
> http://cid-0d9bc809858885a4.skydrive.live.com/self.aspx/DevHawk%20Content/IronPython%20Stuff/^_^_clrtype^_^_/SL%20databinding%20demo.zip 
> <http://cid-0d9bc809858885a4.skydrive.live.com/self.aspx/DevHawk%20Content/IronPython%20Stuff/%5E_%5E_clrtype%5E_%5E_/SL%20databinding%20demo.zip>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ironpython.com/pipermail/users-ironpython.com/attachments/20091111/d6ae55da/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: clrtypesltest.zip
Type: application/x-zip-compressed
Size: 6423 bytes
Desc: not available
URL: <http://lists.ironpython.com/pipermail/users-ironpython.com/attachments/20091111/d6ae55da/attachment.bin>


More information about the Users mailing list