Get Key, and Value From Dictionary

I have a dictionary<Uielement, Double> And I put it in a for each loop. for each item in the dictionary I want to get, the Uielement aaname, and I want to get the double and store them into variables like this…

name = Uielement Item.key.Get(aaname).ToString
value = Item.Value

I want to do this in the for each loop.


I’m just thinking off the top of my head here…
Your dictionary<UiElement, Double> has a list of keys and values, and you can get that list with .Keys.

So if you run it through a For Each, then it would look like this:

For each key In dict.Keys //TypeArgument: UiElement (I think)

which will loop through each key and is of type UiElement.

To get the value, you just use the key with the dictionary variable.
To get the “aaname”, you can just use the key that is being looped.

For each key In dict.Keys
    name = key.Get("aaname").ToString
    value = dict(key)

I apologize if I did that wrong, but hope it gets you in the right direction.



If I’m only traversing through the keys, I’m not sure that I have access to the values. I’m off work in 3 minutes, so I’ll try this tomorrow morning and see what happens. Happy Valentines day~! <3

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.