gpt4 book ai didi

c# - LINQ 检查列表中是否存在 ID

转载 作者:太空狗 更新时间:2023-10-29 17:30:10 26 4
gpt4 key购买 nike

我正在使用 LINQ Entity Framework 。我有一个 SQL 表,我想获取表中所有具有列表中存在的 ID 的项目

这可以用 LINQ 实现吗?

最佳答案

是的,这是可能的。

(from item in yourContext.YourTable where yourList.Contains(item.ID) select item).ToList();

关于c# - LINQ 检查列表中是否存在 ID,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8937826/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com