public IList <SubCategory> GetAllSubCate(int catId) { DataTable dtContact = new DataTable(); UserDetails objUserDetails = new UserDetails(); Category objCategory = new Category(); dtContact = objUserDetails.GetAllSuggestionSubCategoryWise(catId); IList <SubCategory> items = dtContact.AsEnumerable().Select(row => new SubCategory { SubCatId = row.Field <int>("SubCatId"), Name = row.Field <string>("Name"), CatId = row.Field <int>("CatId") }).ToList(); return(items); }