It’s because you used Function instead of Sub. Since a Function returns a value, the compiler considers that the equals sign (=) is used as a comparison, not an assignment. If you change Function to Sub, the compiler would correctly consider the equals sign as an assignment:
TempList.ForEach(Sub(obj) obj.Deleted = True)
If you had a multiline lambda; you wouldn’t have had this problem:
TempList.ForEach(Function(obj)
obj.Deleted = True
Return True
End Function)
Obviously, for the ForEach method it makes no sense to use a Function because the return value wouldn’t be used, so you should use a Sub.