WCFservice.StudentClient ser = new WCFservice.StudentClient("WcfSvcTcpEndPoint"); listView1.Items.Clear(); //till this line it ran ok and in the next row it fell List<WCFservice.StudentDTO> sb = new List<WCFservice.StudentDTO>(); sb=ser.GetAllStudent().ToList<WCFservice.StudentDTO>(); foreach (var item in sb) { string[] s = new string[2]; s[0] = item.IdS; s[1] = item.NameS; ListViewItem i = new ListViewItem(s); listView1.Items.Add(i); }
public class Service1 : IStudent { #region IStudent public List<StudentDTO> GetAllStudent() { StudentBL s = new StudentBL(); List<StudentDTO> sd = new List<StudentDTO>(); foreach (var item in s.GetAllStudent()) { sd.Add(new StudentDTO() { IdS = item.idS, NameS = item.nameS }); } return sd; } public bool AddNewStudent(StudentDTO s) { StudentBL sb = new StudentBL(); return sb.CreateNewStudent(s.IdS, s.NameS); } #endregion }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)