using (var dbcontext = new dbautotest4in1Entities1()) { var hts = dbcontext.hardwaretable.Where(h=>h.hwid == "9500"); hardwaretable bt = hts.First(); Type type = bt.GetType(); List<PropertyInfo> ps = type.GetProperties().ToList(); for(int i =0; i<ps.Count;i++) { if(ps[i].Name.Contains("2018")) { PropertyInfo pi = ps[i]; listBox1.Items.Add(pi.GetValue(bt)); //pi.SetValue(bt, 10f); //dbcontext.SaveChanges(); } }