public static IEnumerable <MachineType> GetFromCSV(byte[] bytes) { string csv = System.Text.Encoding.Default.GetString(bytes); List <MachineType> results = new List <MachineType>(); MachineType mt; try { foreach (string s in csv.Split('\n')) { mt = MachineType.GetFromCsv(s); if (mt != null) { results.Add(mt); } } } catch (Exception ex) { Console.WriteLine(ex.Message); } return(results); }