Banging my head on something that should be simple. Any help is appreciated.
I was thinking generics were now supported in TestStand.
Trying to use a local variable to pass into .NET method, but getting conversion errors. I know it is a mismatch between Array of Strings and the IEnumerable<string>, but not sure how to setup as the variable.
Here is more details.
The .NET Adapter supports all fully-specified generic types that the public members of an assembly use. Thus, the adapter supports any generic type used as a parameter, return value, property, or field type in a public member. For example, you can call an assembly with a method that takes the List<Int32> type as a parameter and you can create instances of the type and call members on the type.
So the question is... how do you setup a variable to pass into method for List<string> or IEnumerable<string>?
You will have to create a List<string> (the class should be available in whatever assembly uses that type in a public member) and then copy the teststand array into that using List<string>.Add() in a For Each Or For loop like the following:
Unfortunately TestStand does not currently support implicit conversion of a TestStand array into a List<T> or IEnumerable<T> of the corresponding basic type. That would be a reasonable feature request though.
Hope this helps,
Some examples of what the module specification looks like:
Thanks for the info. I finally broke down and changed my API to just use a string array to get around this. As you mentioned, it would be nice to get this feature added as many APIs use List and flavors these days.