sách gpt4 ai đã đi

c# - 组合 Where 语句的表达式

In lại 作者:行者123 更新时间:2023-12-03 19:15:14 27 4
mua khóa gpt4 Nike

Có thể trùng lặp:
How do I combine LINQ expressions into one?

public bool IsUnique(params Expression<>>[] properties)
{
var combinedProperties = Combine(properties);
var rowCount = _session.QueryOver().Where(combinedProperties).ToRowCountQuery().RowCount();
return rowCount == 0;
}

Expression<>> Combine(Expression<>>[] properties)
{
???
}

cách sử dụng:

var isUnique = _employeeRepository.IsUnique(x => x.FirstName == commandMessage.FirstName, x => x.LastName == commandMessage.LastName);

有没有一种方法可以将谓词与 AND 运算符结合起来?

27 4 0
行者123
Hồ sơ cá nhân

Tôi là một lập trình viên xuất sắc, rất giỏi!

Nhận phiếu giảm giá Didi Taxi miễn phí
Mã giảm giá Didi Taxi
Giấy chứng nhận ICP Bắc Kinh số 000000
Hợp tác quảng cáo: 1813099741@qq.com 6ren.com