遍历集合ForEach:
listAll.Items.Clear(); List<Users> list = DP.UsersDAO.GetInfoList(); list.ForEach(p => { listAll.Items.Add(string.Format(@"{0}({1})", p.NickName, p.UserName)); });
时间: 2024-10-15 05:29:44
listAll.Items.Clear(); List<Users> list = DP.UsersDAO.GetInfoList(); list.ForEach(p => { listAll.Items.Add(string.Format(@"{0}({1})", p.NickName, p.UserName)); });