List problems (C# UNITY)

List _enemyWaves = enemyWaves;
for (int i = _enemyWaves.Count -1; i >= 0; i–) {
if (_enemyWaves .minimumPoint > GameManager.gameScore)

  •   		_enemyWaves.RemoveAt (i);*
  •   }*

For some reason everything that is removed from _enemyWaves is also removed from enemyWaves. How do I come aroudn this issue?

This line:

List<EnemyWave> _enemyWaves = enemyWaves;

does not create a copy of the list but simply assign the same list reference that is stored in enemyWaves to the _enemyWaves variable. So both variables point to the sam list instance, A generic List is a class and therefore a reference type. If you want to create a copy of the list you have to create a new list:

List<EnemyWave> _enemyWaves = new List<EnemyWave>(enemyWaves);

This will create a new list and fill it with the same elements as the source list-