Continuation of previous question linq where list contains any in list
I have a list of objectA Where ObjectA has 2 properties - string action,bool valid
Ex action =abc, valid = true
action xyz , valid = false
etc
I have two local variables
string actiontocheck ="abc"
string validitychecker ="somevalidvalue" // it can be something else too
I want to check something like Iterate through list .
if any of the action in the list contains actiontocheck and
the corresponding valid flag is true,
if(validitychecker == "somevalidvalue")
set flag to false
What I have tried
if (List1.Any(a => (a.Action.Contains(actiontocheck)) && a.valid)
{
if (validitychecker == "somevalidvalue")
{
Ignore = true;
}
}