private void loadFromConfig(ComboBox comboBoxStyle, string config) { try { using (StreamReader sr = new StreamReader(config)) { while (!sr.EndOfStream) { var readLine = sr.ReadLine(); if (readLine == null) continue; string language = readLine.Trim(); if (!comboBoxStyle.Items.Contains(language)) { comboBoxStyle.Items.Add(language); } } } } catch { // ignored } }
本文转自 OH51888 51CTO博客,原文链接:http://blog.51cto.com/rozbo/1706345,如需转载请自行联系原作者