NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

C# pass delegate parameter

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

 

0 Kudos
Message 1 of 4
(3,650 Views)

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

0 Kudos
Message 2 of 4
(3,641 Views)

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.

0 Kudos
Message 3 of 4
(3,603 Views)

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

0 Kudos
Message 4 of 4
(3,577 Views)