public static List <IMission> GetCommandoMissions(string[] missions) { List <IMission> result = new List <IMission>(); for (int i = 0; i < missions.Length - 1; i += 2) { string codeName = missions[i]; string state = missions[i + 1]; if (state == "inProgress") { Missions mission = new Missions(codeName, MissionStateEnum.inProgress); result.Add(mission); } else if (state == "Finished") { Missions mission = new Missions(codeName, MissionStateEnum.Finished); result.Add(mission); } } return(result); }