【发布时间】:2014-03-03 20:42:39
【问题描述】:
我使用内置的设置文件来存储表单控件的状态。
我使用 System.collections.Specialized.StringCollection 并希望使用 int 值列表。
有办法吗?
【问题讨论】:
-
这是一种避免动态枚举初始化的方法...
我使用内置的设置文件来存储表单控件的状态。
我使用 System.collections.Specialized.StringCollection 并希望使用 int 值列表。
有办法吗?
【问题讨论】:
设置中没有List<T>,所以要自己转换:
var strings = Properties.Settings.Default.Strings; // your StringCollection
List<int> ints = strings.Cast<string>().Select(str => int.Parse(str)).ToList();
【讨论】: