Dictionary with 2 Values

Is is possible to have 2 values for one name?
So
Name Value1 Value2

I need this for selection a template.
First I check if an EmailFrom contains a specific @…
Which is specified in the configfile and thus thus received in dictionary.
From this same Config file I will receive the template name for this.

So it should be handy when Dictionary can have 2 values.

Hi,

Yes you can have two values for one Key, try to have your dictionary as per the below syntax,

Dictionary(Of String, IEnumerable(Of String))

Hi here @marbroer,
Definitely, as noted by @sarathi125, you can include a collection within the entry value.

This could be an Array, List, or an IEnumerable (for example), as stated above.

Thanks in advance,
Josh

Ok, that is great, and how do I refer to the second or third value?

In your case better option use Dictionary(Of String, Tuple(Of String, String)).

dict = New Dictionary(Of String, Tuple(Of String, String)() From { {“key1”, Tuple.Create(“Value1”, “Value2”)}, {“key2”, Tuple.Create(“Value3”, “Value4”)} }

to get value back:
dict(“key1”).Item1 - return “Value1”,
dict(“key1”).Item2 return “Value2”

Hello pleeeeaase I need this help me with a sample sequence…sample sequnce to load such dictionary from excel

I tried the same but it is not working the is missing of ‘)’
can you Please provide any sample xaml

1 Like