private void AddFields(object obj) { IEnumerable list = obj as IEnumerable; foreach (var item in list) { ReportColumn r = new ReportColumn(); r.BindingField = item as QueryFieldBase; SelectedColumnCollection.Add(r); } }
所有的集合类的都会实现IEnumerable接口
http://blog.csdn.net/swarb/article/details/9000405