Dictionary.ByKeysValues


Dictionaries are an incredibly powerful tool for making associative sets between two equal length lists. The first is a list of keys (or indexes) and the second – a set of values (or the data that will be returned for each index).

DynamoSandbox_2016-01-31_18-43-25.png

Inputs:

  • keys: it must consist of unique strings or numbers.
  • values: a value that will be returned for each key.
  • search keys: the list of keys(indexes) that you want returned.

The dictionary values can hold lists of objects:

DynamoSandbox_2016-01-31_18-58-39.png

Or Revit elements:

Revit_2016-01-31_18-59-53.png

If a search key is not found in the dictionary, an empty list will be returned instead.

Advertisements

One thought on “Dictionary.ByKeysValues

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s