February 2007

Sun Mon Tue Wed Thu Fri Sat
        1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28      
Blog powered by TypePad

« .NET 3.0 Released | Main | Vista is Out-a-here! »

Using IEnumerator in LabVIEW

In an earlier post, I described how to convert an ArrayList into a LabVIEW array via the ToArray() method. However, many of the collection types in .NET do not support this method - instead you must use the IEnumerator interface.

After receiving some questions on how best to do this, I created this example to demonstrate the way to loop through the values in the collection.

Things to remember...

  1. This can be expensive for large collections. Converting the collection to a LabVIEW array can make later code easier to write, but make sure the performance is acceptable.
  2. As I show in the example, watch for loose refnums. This is an easy place to forget to close your refnums and end up with a memory leak.
  3. This same example works for searching or any other algorithm where you need to look through the collection monotonically...it isn't just for converting to a LabVIEW array.

TrackBack

TrackBack URL for this entry:
http://www.typepad.com/t/trackback/170720/6733583

Listed below are links to weblogs that reference Using IEnumerator in LabVIEW:

Comments

Post a comment

If you have a TypeKey or TypePad account, please Sign In