Hi I am trying to write an if statement that is checking for any of the conditions within it via OR's and I cannot get it to work I am constantly receiving this error:

Operator '||' cannot be applied to operands of type bool' and lambda expression I have no idea why i am getting this error I have created if statements before and used the OR logical operator || So does anyone have any ideas. It's probably something stupid. I have changed the bracketing multiple times to try and get it working so I don't think that is it, this is my latest attempt:

if((Name.IndexOf("Fail") >= 0) || (seatingPreference == "Fail") || (mealPreference == "Fail") || (myDOB => DateTime.Today) || (myExpiryDate <= DateTime.Today) || (myIssueDate > DateTime.Today))
{
    sendEmail = false;
    error = true;
}

I hope you can help with this very nooby problem! just informing I don't have much experience in C# if you didn't guess

Related posts

Recent Viewed