Example Code

Using a .NET ArrayList in LabVIEW

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW

Code and Documents

Attachment

Description

1. Overview

ArrayLists are collection objects in .NET that are based on objects. Getting LabVIEW data in and out of them can be somewhat confusing at first. This example shows a simple insertion and retrieval.

 

2. Description

So, in the previous post, we saw the difference between the AraryList and the array. The question is, "How do I convert an ArrayList into a LV array" - and quickly. It is reasonable to just iterate through the ArrayList and build up a LV array manually, if there are only a few elements in the list. But what if there are 1,000? 10,000? etc.. The example shows how to do this. The first section is an artifact necessary to create an ArrayList with some data in it - you can ignore it since you should already have your ArrayList. But the next two sections show how to convert the ArrayList into an instance of an Array class, and then convert the Array class to a LV array.

 

3. Requirements

  • NI LabVIEW Base Development System 2012 (or compatible)
  • .NET Framework and a Windows Operating System

 

4. Steps to Implement or Execute Code

  1. Download and open the example "Using a NET ArrayList LabVIEW 2012 NIVerified.vi".
  2. Run the VI.
  3. Explore the block diagram using <Ctrl>+E.

 

5. Additional Information or References

Using a NET ArrayList Screenshot.PNG

 

 

 

**The code for this example has been edited to meet the new Community Example Style Guidelines.**

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.