Dictionaries

Hi @All,

How can we use dictionaries & were we use it.I mean which scenario
What is the main theme of it

1 Like

Hi,

You can actually find information on dictionaries by searching online with like google.

I’m not an expert, but they are basically like datatables, but you can use access the values by both the first column of each row and/or by the column names.

A 2D dictionary would look like this:
Name Value
key1 value1
key2 value2
key3 value3

so you would access all the values by the following syntax:
dict1(key1).ToString or dict(key2).ToString or dict(key3).ToString

A 3D dictionary would be like:
Name keyA keyB keyC
key1 value1A value1B value1C
key2 value2A value2B value2C
key3 value3A value3B value3C

so you get the values with both keys like
dict(key1)(keyA).ToString
et cetera

Or the 3D dictionary could use sheetnames instead of columns to organize groups of settings. Or you can just store everything to a single 2D dictionary using 1 key per value.

You would initialize your dictionary by reading in an Excel, Text, or Json file then run each entry through a For loop. To go further you can even convert strings to an array with Json convert (is one method), and since the dictionary can store Objects, you can store any type from Integer/Numbers to Dates to Strings to Lists during your initialization phase.

The most common use for dictionaries will be to store a set of settings (global variables) that you will use within your project. However, it is recommended in my opinion to pass to workflow modules as individual arguments for each settings, because if you only send the dictionary as one, then you need to remember all the key values.

Well anyway, I just typed this up quick. To keep it simple, think of it like using a datatable to access data but is more powerful and versatile.

Regards.

6 Likes

Hi @ClaytonM

u have any document for this

Hi @varunk,

Refer this link
C# Dictionary Examples - Dot Net Perls

Regards,
Arivu

Not really, sorry. I just tried to explain it the best I could from my limited experience.
Here are some results that google returned:
See below repost…

Thanks

Thanks

lol Sorry, I searched for the book dictionary.

Here is a better search result:

https://www.google.com/search?rlz=1C1GGRV_enUS751US751&ei=VeGUWu2PIIbEsAXJ6L6oBQ&q=dictionaries+benefits+programming+vb.net&oq=dictionaries+benefits+programming+vb.net&gs_l=psy-ab.3…15324.16480.0.16633.7.7.0.0.0.0.173.796.3j4.7.0…0…1c.1.64.psy-ab…0.6.697…33i160k1j33i22i29i30k1j33i21k1.0.97Zwk631KOM

2 Likes

hi,

Please follow the tutorial,

thanks,
Karthik.

2 Likes

A mention on the required package would have been useful: Microsoft.Activities.Extensions

2 Likes