<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Hi,<br>
I haven'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">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>
&nbsp;&nbsp;&nbsp; if not isinstance(signature_types, tuple):<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; signature_types = (signature_types,)<br>
&nbsp;&nbsp;&nbsp; for t in signature_types:<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; clr_type = clr.GetClrType(t)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if t == Void:<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; raise TypeError("Void cannot be used in signature")<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if clr.GetPythonType(clr_type) != t and \<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; clr.GetPythonType(clr_type) != clr.GetPythonType(t):<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; raise Exception, "Invalid CLR type %s" % str(t)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if not var_signature:<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if clr_type.IsByRef:<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; raise TypeError("Byref can only be used as arguments
and locals")<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # ArgIterator is not present in Silverlight<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if hasattr(System, "ArgIterator") and t ==
System.ArgIterator:<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; raise TypeError("Stack-referencing types can only be
used as arguments and locals")<br>
<br>
--<br>
-- Luk&aacute;&#353;<br>
<br>
Simon Segal wrote:
<blockquote
 cite="mid:b16c60b10912171937n29f486d9v1925c5733e98c789@mail.gmail.com"
 type="cite">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>
  <pre wrap="">
<hr size="4" width="90%">
_______________________________________________
Users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Users@lists.ironpython.com">Users@lists.ironpython.com</a>
<a class="moz-txt-link-freetext" href="http://lists.ironpython.com/listinfo.cgi/users-ironpython.com">http://lists.ironpython.com/listinfo.cgi/users-ironpython.com</a>
  </pre>
</blockquote>
<br>
</body>
</html>