Grasshopper

algorithmic modeling for Rhino

the vb.Net documentation online says that the class HashSet is available but I can't seem to use it in GH - is there something else I should be working with?

Views: 291

Replies to This Discussion

im just looking for a quick way to cycle through a long list of objects and add only one for each type to a collection or list...is there another way?
Gabriel,

how do you compare types?

Typically I use System.Collections.Generic.SortedList or System.Collections.Generic.SortedDictionary. Dictionary has a better performance (especially during insertion), but it doesn't allow easy iteration.

--
David Rutten
david@mcneel.com
Poprad, Slovakia
hmm, I'm not sure i understand the question. I want to compare strings, each entry having its own unique string. I developed a loop to do this in the meantime...so i think I'm ok.
Ah ok, Strings are easy to compare. If you don't care much for performance you can just use List(Of String) and ask for Contains() before you add a new entry. If you have to build a giant unique collection of an even bigger sample set and it has to happen snappy like, definitely use a SortedDictionary(Of String, Boolean). Just ignore the Boolean values, you only care about the String keys.

--
David Rutten
david@mcneel.com
Poprad, Slovakia

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service