void MyFunc(CodeClass2 cc, string EventName)
{
CodeFunction cf = cc.AddFunction(EventName, vsCMFunction.vsCMFunctionSub, vsCMTypeRef.vsCMTypeRefVoid, -1)
cf.AddParameter("Sender", vsCMTypeRef.vsCMTypeRefObject, -1)
CodeTypeRef2 ctr = cm.CreateCodeTypeRef("System.Collections.Generic.List")
CodeParameter prmEvent = cf.AddParameter("e", ctr, -1)
}
Is it possible to specify the 'type' parameter of the ctr (CodeTypeRef2) object. The CodeTypeReference object of CodeDom allows
one to set the TypeArguments member.
The only thing I can think of is to manually insert the <> generic syntax, however then I need to check the language of the file,
which somewhat defeats the purpose of using the code model.
Cheers and thanks for any insight,
Stu
"Gary Chang[MSFT]" - 20 Apr 2006 10:09 GMT
Hi Stuart,
>Is it possible to specify the 'type' parameter of the ctr
>(CodeTypeRef2) object. The CodeTypeReference
>object of CodeDom allows one to set the
>TypeArguments member.
Have you try to specify the type argument in the CodeTypeReference object's
definition directly, for example:
CodeTypeRef2 ctr =
cm.CreateCodeTypeRef("System.Collections.Generic.List<string>")
Thanks!
Best regards,
Gary Chang
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
Stuart Carnie - 20 Apr 2006 21:17 GMT
Thanks Gary - that works for C#, but not for VB.NET.
I tried the obvious, and that generated (Of T) instead of (Of System.String). The "obvious" was:
CodeTypeRef2 ctr = cm.CreateCodeTypeRef("System.Collections.Generic.List(Of System.String)")
It generates:
Sub MyTest(aList as System.Collections.Generic.List(Of T))
End Sub
Is this a bug?
Cheers,
Stu
Gary Chang[MSFT] wrote:
> Hi Stuart,
>
[quoted text clipped - 20 lines]
> ==================================================
> This posting is provided "AS IS" with no warranties, and confers no rights.
"Gary Chang[MSFT]" - 24 Apr 2006 08:54 GMT
Hi Stuart,
It may be a product issue. I suggest you can submit this issue to our
product feedback center, our development team may communicate with you
directly on the issue there:
http://lab.msdn.microsoft.com/productfeedback/default.aspx
Thanks for your understanding.
Best regards,
Gary Chang
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.