Hi, i wants to store the key and value of an enumerator to a dictionary, but i have no idea about how to convert enumerator.value to type of double :

public void Display1()
             Dictionary<string, double> sortList2 = new Dictionary<string, double>();                   
             Dictionary<string, double> sortList3 = new Dictionary<string, double>(); 
             IDictionaryEnumerator enumerator2 = sortList2.GetEnumerator();
             string str = String.Empty;
             while (enumerator2.MoveNext())
                 listbox.Items.Add("(" + enumerator2.Key.ToString() + "): " + " " + enumerator2.Value.ToString() + "\n");                
                 str = enumerator2.Key.ToString();

                 sortList3.Add(str,?); //want convert value to double type, how?

try this


if it doesn't work then check the following code to convert you enumvalue into double

double dblVar = (doubleenumerator2.GetType().GetField("value__").GetValue(objYourEnum)

ermm, what should i put for "enuYourEnum" and "objYourEnum" in my case?

enuYourEnum is the name of your enumerator and objYourEnum is the value you want to get

double dblVar = (double)enumerator2.GetType().GetField("value__").GetValue(enumerator2.Value);

i put like this, is it correct?