I have a List<businessobject> object collection and a List<string> object collection. I want filter my List<businessobject>so that if a certain property in the business object equals anything the List<string> it will be filtered out. I can think of writing the code this way, but is there any faster or better way?
List<businessobject> bo = loadBusinessObjectList();
List<string> stringList = loadStringList();
foreach(businessobject busobj in bo){
if(stringList.contains(busobj.myProperty))
bo.remove(busobj)
}
Much simpler than the rest of the code posted so far…