sampleList.RemoveAll(a=>a.reference.Contains("123"));
This line of code does not remove any item from the list whereas
sampleList.RemoveAll(a=>!a.reference.Contains("123"));
removes all the items.
I have currently resorted to making another list and going through a for loop and adding stuff to the second list, but I dont really like this approach.
Is there a cleaner way to achieve what I am trying ?
The fact that the second example “removes all the items” and the first removes none, leads me to conclude that none of the item’s
referenceproperty in the list contains the string “123”.Elementry my dear watson 😉