I have the follwing two lambda expression. Can you please help me how can I combine them into one.
private bool CheckForNonUniqueRollNumbers(IEnumerable<EmployeeInfoDto> empDtos)
{
var dtosToCheck = empDtos.Where(dto => dto.ExceptionIfAny == null).ToList();
var allNumbersEmpty = empDtos.All(dto => dto.Identity.RollNumber == "");
if (dtosToCheck.Any() && !allSerialNumbersEmpty)
{
}
I want to combine above two queries
I tried the following query, but I am not sure if this is correct
var dtosToCheck = empDtos.Where(dto => dto.ExceptionIfAny == null
|| dto.Identity.RollNumber == "").ToList();
if (dtosToCheck.Any())
{
}
Thanks.