向ComboBox列表框中添加Enum的全部数据

 

 

相当于利用反射的 GetValues与GetNames

foreach (HETieXinType theType in Enum.GetValues(typeof(HETieXinType)))

foreach (string mode in Enum.GetNames(typeof(BooleanInteractionMode)))
{
ledResponseModesComboBox.Items.Add(mode);
switchResponseModesComboBox.Items.Add(mode);
}

 

从字符串变成枚举

(AITerminalConfiguration)Enum.Parse(typeof(AITerminalConfiguration), terminalConfigurationComboBox.SelectedItem.ToString())

你可能感兴趣的:(向ComboBox列表框中添加Enum的全部数据)