public List <Ders> DersSelect() { List <Ders> result = new List <Ders>(); con.Open(); SqlCommand komut = new SqlCommand("select * from Ders", con); SqlDataReader dr = komut.ExecuteReader(); while (dr.Read()) { Ders ders = new Ders() { derskod = Convert.ToInt32(dr[0]), dersad = Convert.ToString(dr[1]) }; result.Add(ders); } con.Close(); return(result); }