LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I access one element of a .NET ArrayList?

A Tektronix TPI.NET property (ITlaSystem.DataWindows) is an ArrayList of references to Object types. I need to figure out which one is an IListingWindow, and get a refnum to that object. How do I do this in LabVIEW?
0 Kudos
Message 1 of 5
(3,042 Views)
I would suggest looking at the API for Tektronix and see if there is a method for the Object type that will return the class of that Object. The problem with just looking at the DLL is that I'm not able to see all the available methods and properties of more generic objects without using the To More Generic Class.vi to cast the various datatypes. Looking at the API would be the easiest way and there is probably some sort of method that will return the more specific class type of that particular object.

Hope this helps.

Kileen C.
NI
0 Kudos
Message 2 of 5
(3,041 Views)
There is no such method. The manual recommends using "reflection," which I will probably also need help with.

More importantly, I cannot get the reference to those objects out of the ArrayList. It is a System.Collections.ArrayList. I should be able to run methods on that such as Contains, BinarySearch, and Clone, but if I attach a property node or invoke node to the ArrayList output of another method it doesn't have any options. Also, I cannot construct an ArrayList; System.Collections isn't a choice.

Thank you.
0 Kudos
Message 3 of 5
(3,041 Views)
Sounds like you might want to change your ArrayList implementation. Because the ArrayList is currently storing an array of generic Objects, you are unable to cast the objects down to their specific type. You might want to have separate ArrayList collections that store only objects of a particular type. Or, see if you can avoid having the array structure altogether and perform the object manipulations directly when the object is acquired.

Note that .NET objects in LabVIEW will not display methods or properties that are inherited. The only way to have access to those methods/properties would be to use the To More Generic Class.vi.

If possible, post your LabVIEW code and I can see if there are any other alternative solutions.

Thanks
!

Kileen C.
NI
0 Kudos
Message 4 of 5
(3,041 Views)
If this can still help, I have an answer to your problem :

by using ArrayList.get_item,
and then cast the result with the LabVIEW TypeCast command to your desired class.

Hope this is clear ;
Message 5 of 5
(3,014 Views)