Iterate through String,Float dictionary.

Hi, how do i do this ?

foreach (string gunStat in attachStats.Keys) 

where attachStats is

Dictionary<string,float> attachStats

Iterating that way returns me an error…

You can iterate through a Dictionary using:

foreach(KeyValuePair<string,float> attachStat in attachStats)
    //Now you can access the key and value both separately from this attachStat as: