更新时间:2023-02-09 20:54:03
PITA的一点点 - 因为Addrange方法只接受一个对象数组,但是.. 。
尝试:
Little bit of a PITA - because the Addrange method only accepts an array of objects, but...
Try:
myComboBox.Items.AddRange(Enumerable.Range(1, 100).Select(i => (object) i).ToArray());
问题不明确,你的意思是?
Question is not clear, did you mean?
var list = comboBox1.Items.Cast<int>().Select(item => item).ToList().GetRange(0,100);