private void butText_Click(object sender, EventArgs e)
{
List<Stu> list = new List<Stu>();
Stu s1 = new Stu();
s1.Name = "";
s1.Id = 1;
list.Add(s1);
Stu s2 = new Stu();
s2.Name = "";
s2.Id = 2;
list.Add(s2);
Stu s3 = new Stu();
s3.Id = 3;
s3.Name = null;
list.Add(s3);
list = list.Where(t => !string.IsNullOrEmpty(t.Name)).ToList();
MessageBox.Show(list.Count.ToString());
}
public class Stu
{
public int Id { get; set; }
public string Name { get; set; }
}