<div>You should template on VertexPositionColor, not on VertexPositionColor[].</div>
<div> </div>
<div>The reason for the error message is that you&#39;re saying T is VertexPositionColor[]. An array is a reference type, while the template constraint specifies a value type.<br></div>
<div class="gmail_quote">On Tue, Feb 2, 2010 at 7:51 AM, Richard Steventon <span dir="ltr">&lt;<a href="mailto:steventon@gmail.com">steventon@gmail.com</a>&gt;</span> wrote:<br>
<blockquote style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class="gmail_quote">Okay, so problem #2.... calling the correct version of the interface<br>(I think this is the problem?), since I am getting a &quot;violates the<br>
constraint of type &#39;T&#39;&quot; error.<br><br>I set up a XNA VertexBuffer using:<br>       l = Array.CreateInstance(VertexPositionColor,6)<br>       .....<br>       self.vertices = l<br><br>Then:<br>       self.VertexBuffer = VertexBuffer(self.graphics.GraphicsDevice, \<br>
           len(self.vertices) * VertexPositionColor.SizeInBytes, \<br>           BufferUsage.WriteOnly)<br>       self.VertexBuffer.SetData[Array[VertexPositionColor]](self.vertices)<br><br>And I get:<br>ValueError: GenericArguments[0],<br>
&#39;Microsoft.Xna.Framework.Graphics.VertexPositionColor[]&#39;, on &#39;Void<br>SetData[T](Int32, T[], Int32, Int32, Int32)&#39; violates the constraint<br>of type &#39;T&#39;.<br><br>The documentation for the VertexBuffer.SetData method can be found here:<br>
<a href="http://msdn.microsoft.com/en-us/library/microsoft.xna.framework.graphics.vertexbuffer.setdata.aspx" target="_blank">http://msdn.microsoft.com/en-us/library/microsoft.xna.framework.graphics.vertexbuffer.setdata.aspx</a><br>
<br>The methods are:<br> VertexBuffer.SetData (Int32, T[], Int32, Int32, Int32)<br> VertexBuffer.SetData (T[])<br> VertexBuffer.SetData (T[], Int32, Int32)<br><br>This works fine in C# with a List of VertexPositionColor objects, so I<br>
assume that Array in IronPython is the equivalent ?  So why does it<br>not work ?<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></blockquote></div><br>