日期:2014-05-18 浏览次数:21066 次
List<string> list=new List<string>(); foreach (Control cl in Controls) { if (cl is TexBox) { if (!String.IsNullOrEmpty(((TexBox)cl).Text)) { list.Add(c.Text.ToString()); } } } 取交集自己处理
------解决方案--------------------
TextBox[] textboxs = new TextBox[] { A, B, C, D, E }; var result = textboxs.SelectMany(x => x.Text.Split(',')).Distinct(); textboxs.Where(x => x.Text != "").ToList().ForEach(x => result = result.Where(y => x.Text.Split(',').Contains(y)));