How to remove an object with a specific value from a list

it’s probably easy but i can’t find an answer googling it, basicly what i want is when an enemy is dead remove him from the list.
here is the code, at least how i think it goes somewhat similar, but this doesn’t work

foreach(EnemyStats eStats in targets.Select(T => T.GetComponent<EnemyStats>()))
			{
				if(eStats.Health <= 0)
					targets.Remove(this.gameObject);
			}

In Linq there is a RemoveAll extension method which takes a predicate of whether it should be removed.

Eg (not tested):

targets.RemoveAll((target) => { return target.GetComponent<EnemyStats>().health <= 0; });

You can’t modify the list while you are iterating through it.

Make another list where you store the targets you have to remove and remove them after the foreach.