ScriptLanguage tmp = (ScriptLanguage)(Enum.Parse(typeof(ScriptLanguage), comboBox1.SelectedValue.ToString()));
其中 ScriptLanguage是枚举的类型,comboBox1.SelectedValue.ToString();是要转换为枚举类型的字符串,这里是comboBox1中被选中的字符串,tmp是转化得到的结果。 


转载优特建站:http://www.youtiy.com/Articles/Item.aspx?Id=268