10-20-2016 07:08 AM
Hi,
I'm using TestStand 2014 and C#.
In my C# DLL I have a method where one of the parameters is a delegate.
In the Step Settings (NET Invocation) the calling of the method looks as following
Core().Message(NationalInstruments.TestStand.Interop.API.SequenceContext, System.Func<NationalInstruments.TestStand.Interop.API.SequenceContext, System.String>)
Question:
How can I pass a "delegate" parameter?
Thanks
10-20-2016 08:29 AM
What are you trying to do? What method do you want the delegate to call? Does the method accept null if you don't want it to call anything? Is that what you want to pass it?
-Doug
10-22-2016 01:25 AM
Thank you for the quick response.
I just want to understand is it possible to call from TestStand the method which accepts delegate as parameter. So, it is doesn't matter what exactly a method/delegate trying to do. In my case I have method Message from my class Core. The Message performs some common operations as UDP client. The accepted delegate performs some specific operations and has signature like string MyDelegate(SequenceContext seqContext).
Let's say in my Core class I have methods string BuildMessage1(SequenceContext seqContext) , string BuildMessage2(SequenceContext seqContext), and them will be passed as the delegate parameter. I'm not planning to pass null.
Thank you.
10-24-2016 08:06 AM
I don't think there is any way to directly create the delegate in TestStand. I think you will have to write a wrapper function that registers those delegates. Either that or create a wrapper method that returns a delegate that you can then store in a TestStand local variable and then pass into the method expecting a delegate.
-Doug