In C#, generic type parameters are resolved at compile time. Your code results in the following:
var _list = new List<"System.String">(); instead of the following valid line: var _list = new List<System.String>(); One option for your code is using the non-generic ArrayList type. Here's an additional reference: http://stackoverflow.com/questions/266115/pass-an-instantiated-system-type-a s-a-type-parameter-for-a-generic-class Sam -----Original Message----- From: [email protected] [mailto:antlr-interest-boun...@antlr. org] On Behalf Of ?? Sent: Monday, August 30, 2010 3:16 AM To: [email protected] Subject: [antlr-interest] C# issue about action code with generic type. Hi, All, I encounter some troubles when try to embedded action code with generic type in C#. Here is my case: list: LIST_TYPE { var _list = new List<$LIST_TYPE.text>(); } ; My purpose here is getting generic type from LIST_TYPE, and create a generic list, such as List<string>, List<int> and so on. However, $LIST_TYPE.text returns a string value, which makes compile failed. Any suggestion? -- Han kai "To iterate is human, to recurse divine." - L. Peter Deutsch List: http://www.antlr.org/mailman/listinfo/antlr-interest Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address List: http://www.antlr.org/mailman/listinfo/antlr-interest Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address -- You received this message because you are subscribed to the Google Groups "il-antlr-interest" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/il-antlr-interest?hl=en.
