var urList = allcategory.Select(u => new { u.ArticleCategoryId }).ToArray(); string[] objectIdStr = new string[urList.Length]; int i = 0; foreach (var item in urList) objectIdStr[i++] = item.ArticleCategoryId.ToString(); dataList = dataList.Where(a => objectIdStr.Contains(a.ArticleCategoryId));
db.Sys_UserRelation.RemoveRange(dataList);
学习交流群:364976091