public static void RemoveAllHeroes(string name, out List<Hero> sub) { List<Hero> sub = new List<Hero>(); for (int i = 0; i < _heroes.Count; i++) { if (_heroes[i].Name.StartsWith(name, StringComparison.OrdinalIgnoreCase)) { sub.Add(_heroes[i]); _heroes.RemoveAt(i); } } }