01-24-2013 02:40 AM
I appologise for another probably stupid question: I would like to use a variable / parametre (which ever you choose to call it) within my method. It appears that all of the templates are configured for outputs only. eg:-
public void DummyFunctionName(out double[] measurements, out String reportText, out bool errorOccurred, out int errorCode, out String errorMsg)
I have tried creating my own method with in types but it seems that the format for methods is fixed someplace else; maybe in the Interop.api ? I don't know ?
I have also verified that it is impossible to pass into something that is defined as out.
Solved! Go to Solution.
01-24-2013 02:51 AM
If the function protoype within your assembly defines parameters solely as "out", there is no way in TestStand to change this.
So you have to change this in the sources of the assembly and recreate it.
Norbert
01-24-2013 03:10 AM
Thanks Norbert,
Maybe I wasnt clear in my question: I am trying to create methods who take parametres and return variables. If I change any of the types in the template to be an "in". eg.:-
public void DummyFunctionName(in double[] measurements, out String reportText, outbool errorOccurred, outint errorCode, out String errorMsg)
This is the response from the compiler:-
Error 1 Type expected \\locationofmydrive Templetes\MultiNumericLimitArrayDataSourceCSharp.NET\dotnet.cs 6 32
Error 2 Identifier expected; 'out' is a keyword \\locationofmydriveTempletes\MultiNumericLimitArrayDataSourceCSharp.NET\dotnet.cs 6 58
.....and another 22 similar errors.
01-24-2013 03:34 AM
I don't know what you are talking about.
But you might want to try to leave out the "in" keyword.
Norbert
01-24-2013 05:13 AM
Ok,
I'll try and clear up my question with an example:-
I have two methods/functions below that both perform the same task.
public void multiply_by (int number1, int number2)
{
Number3 = number1 * number2;
}
public int mult_by(int number1, int number2)
{
return number1 * number2;
}
How do I get number1 and number2 into the methods/functions ?
01-24-2013 05:47 AM
Once you build a working assembly (most probable using MS Visual Studio), you can include the assembly in your TestStand sequence.
Drop a step using a code module, select the .NET adapter. Browse to the assembly, select the root class. Now you should be able to select one of the functions as ".NET Invocation". The parameter list should populate by itself:
Parameters using the "out" keyword are return values of the module and cannot pass data INTO the function.
Parameters without any keyword are used as input for the module.
TestStand will show you if a parameter is "in" or "out". Returnvalues (public INT [...] return [..]) are always "out".
Norbert
01-24-2013 06:12 AM
Thanks Norbert,
Omitting the out keyword is what makes it a parameter. Sorry to ask such obvious seeming questions but the answer is only easy if you know it.
Cheers