You can ensure that tempOutput is not a fixed-length list by initializing it as var tempOutput = new List<String>.from(input); thereby declaring tempOutput to be a mutable copy of input.