在 LINQ 语句中,可以使用 'Contains' 方法对 'List' 进行模糊查询。以下是一个示例:

List<Guid> searchGuids = new List<Guid> { guid1, guid2, guid3 }; // 要查询的多个 Guid

var result = from item in yourList
             where searchGuids.Contains(item.Id)
             select item;

在上述示例中,'searchGuids' 是一个包含多个要查询的 Guid 的 'List'。然后,使用 'Contains' 方法在 LINQ 查询中检查 'item.Id' 是否存在于 'searchGuids' 列表中,如果存在,则返回匹配的项。

LINQ 语句中使用 List<Guid> 进行模糊查询

原文地址: https://www.cveoy.top/t/topic/x2a 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录