Thanks a lot Lukáš that gets me past this issue.<br><br>
<div class="gmail_quote">On Fri, Dec 18, 2009 at 9:00 PM, Lukas Cenovsky <span dir="ltr">&lt;<a href="mailto:cenovsky@bakalari.cz">cenovsky@bakalari.cz</a>&gt;</span> wrote:<br>
<blockquote style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class="gmail_quote">
<div text="#000000" bgcolor="#ffffff">Hi,<br>I haven&#39;t tried your code, but there are currently 2 small issues with clrtype.py I know of:<br><br>1. You cannot use iterable for @returns and @accepts - see <a href="http://ironpython.codeplex.com/WorkItem/View.aspx?WorkItemId=25448" target="_blank">http://ironpython.codeplex.com/WorkItem/View.aspx?WorkItemId=25448</a> I think your issue is similar.<br>
<br>2. You cannot use Python classes with clrtype.ClrClass metaclass in @accepts and @returns.<br><br>Both issues can be fixen in validate_clr_types function in clrtype.py. Here is my version:<br><br>def validate_clr_types(signature_types, var_signature = False):<br>
    if not isinstance(signature_types, tuple):<br>        signature_types = (signature_types,)<br>    for t in signature_types:<br>        clr_type = clr.GetClrType(t)<br>        if t == Void:<br>            raise TypeError(&quot;Void cannot be used in signature&quot;)<br>
        if clr.GetPythonType(clr_type) != t and \<br>                clr.GetPythonType(clr_type) != clr.GetPythonType(t):<br>            raise Exception, &quot;Invalid CLR type %s&quot; % str(t)<br>        if not var_signature:<br>
            if clr_type.IsByRef:<br>                raise TypeError(&quot;Byref can only be used as arguments and locals&quot;)<br>            # ArgIterator is not present in Silverlight<br>            if hasattr(System, &quot;ArgIterator&quot;) and t == System.ArgIterator:<br>
                raise TypeError(&quot;Stack-referencing types can only be used as arguments and locals&quot;)<br><br>--<br>-- Lukáš<br><br>Simon Segal wrote: 
<blockquote type="cite">
<div>
<div></div>
<div class="h5">I am curious as to how to define a System.Collections.Generic.ICollection as per the below with @clrtype.accepts and @clrtype.returns. Same question goes for _clrfields where I want an ICollection&lt;T&gt; (c#) as a field.<br>
<br>@property<br>@clrtype.accepts()<br>@clrtype.returns(ICollection[Order])<br>def Orders(self): return self._orders<br><br>@Orders.setter<br>@clrtype.accepts(ICollection[Order])<br>@clrtype.returns()<br>def Orders(self, value): self._orders = value<br>
<br>Thanks,<br><br>Simon<br></div></div><pre><hr size="4" width="90%">
_______________________________________________
Users mailing list
<a href="mailto:Users@lists.ironpython.com" target="_blank">Users@lists.ironpython.com</a>
<a href="http://lists.ironpython.com/listinfo.cgi/users-ironpython.com" target="_blank">http://lists.ironpython.com/listinfo.cgi/users-ironpython.com</a>
  </pre></blockquote><br></div><br>_______________________________________________<br>Users mailing list<br><a href="mailto:Users@lists.ironpython.com">Users@lists.ironpython.com</a><br><a href="http://lists.ironpython.com/listinfo.cgi/users-ironpython.com" target="_blank">http://lists.ironpython.com/listinfo.cgi/users-ironpython.com</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br>Regards,<br><br>Simon Segal<br>MCSD, MCDBA, MCSE, MCTS - Biztalk<br><br>Mobile: 0414854913<br>Email: <a href="mailto:simon.segal@simonsegal.net">simon.segal@simonsegal.net</a><br>
Web Site: <a href="http://www.simonsegal.net">http://www.simonsegal.net</a><br>