NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Iterating Generic .NET List

Solved!
Go to solution

 

Very good catch;  the ReadOnlyDictionary in the example is indeed an implementation of IDictionary<> rather than a subclass of Dictionary<> and this explains the the ICollection<>.

 

Thanks for the explaination of Root Class list.  This makes sense.

 


0 Kudos
Message 11 of 17
(1,830 Views)

Hi

 

I have my list as an object reference i the seq.

 

How do i get the size of the list ?  (locals.mylist.xxxxxx)

How do i use the list element number for iterating the for loop (locals.mylist.yyyyyyy)

 

 

br

Nikolaj

 

0 Kudos
Message 12 of 17
(1,749 Views)

Hi

 

From which class is your List.

Could you provide a screen shoot from that step where you get your reference.

 

Regards

 

Juergen

--Signature--
Sessions NI-Week 2017 2016
Feedback or kudos are welcome
0 Kudos
Message 13 of 17
(1,744 Views)

This is just a simple trial, for me to understand how to get data from C#.

 

I just create a list and output it to TS.

It's referenced/stored in locals.local_3.

 

I would like to check all values in the list in e.g. a numeric limit step.

How do i check the number of elements in the list ?

Download All
0 Kudos
Message 14 of 17
(1,739 Views)

Hi

 

after you get your reference to the .net Listobject with first  step.

you have to use in the second step the .net adapter as well. Not the - none - Apapter!

 

your  Root Class is: System.Collections.Generic.List<Int32>

 

.Net Invocation: Use Existing Object . In your case Local_3

to get the size just use the Count property.

 

 

Hope that helps

 

Juergen

 

 

 

--Signature--
Sessions NI-Week 2017 2016
Feedback or kudos are welcome
0 Kudos
Message 15 of 17
(1,734 Views)

how do i use the count property ?

 

I can't find it on the "locals.local_3.xxxx" in through the expression field.

0 Kudos
Message 16 of 17
(1,729 Views)

I found out how to do it.

thanks a lot for your help, it was very useful !

 

br

Nikolaj

0 Kudos
Message 17 of 17
(1,725 Views)