List A:
1, 2, 3, 4
List B:
2, 5
How to check if list A contains any value from list B?
e.g. someth
Sorry, if this is irelevant, but will return list with matches using FindAll() in case you need this:
private bool IsContain(string cont)
{
List ListToMatch= new List() {"string1","string2"};
if (ListToMatch.ToArray().Any(cont.Contains))
{
return false;
}
else
return true;
}
And usage:
List ListToCheck = new List() {"string1","string2","string3","string4"};
List FinalList = ListToCheck.FindAll(IsContain);
The final list contains only the matched elements string1 and string2 from list to check. Can easy be switched to int List.