[IronPython] .NET attributes for methods

Shri Borde Shri.Borde at microsoft.com
Wed Nov 11 02:05:05 CET 2009


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>

Shri Borde wrote:

The following files extend DevHawk's blog and adds support for typed methods with attributes. It will be available as part of the samples released with the 2.6 RTM (over the next month). Do let us know if it works for you.



Also, I would be curious to know what scenario you need method attributes for (other than DllImport for pinvokes)...



-----Original Message-----

From: users-bounces at lists.ironpython.com<mailto:users-bounces at lists.ironpython.com> [mailto:users-bounces at lists.ironpython.com] On Behalf Of Lukas Cenovsky

Sent: Thursday, October 22, 2009 10:37 AM

To: Discussion of IronPython

Subject: [IronPython] .NET attributes for methods



Hi,

I have read all DewHawk blogposts about .Net attributes in IronPython

via __clrtype__ metaclass

(http://devhawk.net/CategoryView,category,__clrtype__.aspx). He

describes how to add attributes to classes but not to methods. Is there

any example how to add attributes to a method. It looks like method

generation is necessary (like for getter and setter or in

http://www.voidspace.org.uk/python/weblog/arch_d7_2007_03_10.shtml#e659)

but this is kind of deep magic for me...

Thanks.



--

-- Lukáš

_______________________________________________

Users mailing list

Users at lists.ironpython.com<mailto:Users at lists.ironpython.com>

http://lists.ironpython.com/listinfo.cgi/users-ironpython.com










________________________________






_______________________________________________

Users mailing list

Users at lists.ironpython.com<mailto: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/20091111/f43b0fe6/attachment.html>


More information about the Ironpython-users mailing list