Exemplo n.º 1
0
 public static T[] ReadCsvFile <T>(string filepath)
 {
     using (CsvReader csv = new CsvReader(new StreamReader(filepath), false))
     {
         TypeConverter converter = TypeDescriptor.GetConverter(typeof(T));
         return
             (csv.SelectMany(
                  v => v.Select(u => (T)converter.ConvertFromString(null, CultureInfo.InvariantCulture, u)))
              .ToArray());
     }
 }