public List <LoaiBean> themLoai(List <LoaiBean> ds, string maLoai, string tenLoai, out Boolean kq) { kq = false; // lấy về tất cả các loại có mã là maLoai var q = from l in ds where l.MaLoai.Equals(maLoai) select l; if (q.Count() == 0) { // thêm csdl loai.themLoai(maLoai, tenLoai); // thêm bộ nhớ LoaiBean lb = new LoaiBean(maLoai, tenLoai); ds.Add(lb); //check = true; kq = true; } //else //{ // check = false; //} return(ds); }