Feature request: List support in Macro expression
We would like to reference list elements of generic lists like var olist := List
Describe the solution you'd like Currently this finishes with an exception "Conversion error from usual (object) to array
Describe alternatives you've considered An example is in the attached program in the function testmacrolist()
Additional context
Add any other context or screenshots about the feature request here.
Program.zip

Arne, This will be difficult, since there is no real context from which the macro compiler can read the type of the usual. Even if we would not cast the usual to array and if we would use the index properties of the usual type at runtime, what would you expect then to happen with the index. Would you expect that the index would be 0 based (like for the List<> class) or would the index be 1 based (like for arrays).
Have you tried explicitly casting like this:
o:testmacrop1("((System.Collections.IList)olist)[1]", "olist", olist)
I know that casting to a generic type does not work yet. This is on our todo list. So this will not work:
o:testmacrop1("((System.Collections.Generic.IList<int>)olist)[1]", "olist", olist)
Robert
Robert,
thank you. This works: o:testmacrop1("((System.Collections.IList)olist)[1]", "olist", olist)
We were only thinking about this possibility. We understand that it is difficult because the context is missing indeed.
Would you expect that the index would be 0 based (like for the List<> class) or would the index be 1 based (like for arrays). I would expect 0 based as is also in the hard coded variant.
Nikos is going to add support for parsing generic types in one of the next builds of the macro compiler. In that case you should also be able to cast it to (System.Collections.Generic.IList