public static List <List <string> > ParseString(string csvString, CsvParser.DelimiterType delimiterType = CsvParser.DelimiterType.Auto, bool ignoreEmptyLines = true) { List <List <string> > list = new List <List <string> >(); CsvParser.ParseString(csvString, new CsvParser.ParserCallback(list.Add), delimiterType, ignoreEmptyLines); return(list); }
public static List <object> DeserializeData(string csvString, CsvDataDescriptor descriptor, int headerRow = 0, CsvParser.DelimiterType delimiter = CsvParser.DelimiterType.Auto, IEnumerable <Type> customTypes = null) { List <List <string> > list = CsvParser.ParseString(csvString, delimiter, true); if (headerRow >= list.Count) { throw new ArgumentException("Header row index bigger then data!", "headerRow"); } return(CsvSerializer.DeserializeData(list, descriptor, headerRow, delimiter, customTypes)); }
public static List <T> DeserializeData <T>(string csvString, CsvDataDescriptor descriptor = null, int headerRow = 0, CsvParser.DelimiterType delimiter = CsvParser.DelimiterType.Auto) where T : new() { List <List <string> > parsedCsv = CsvParser.ParseString(csvString, delimiter, true); return(CsvSerializer.DeserializeData <T>(parsedCsv, descriptor, headerRow)); }
public static List <List <string> > ParseFile(string fileName, CsvParser.DelimiterType delimiterType = CsvParser.DelimiterType.Auto, bool ignoreEmptyLines = true) { string csvString = File.ReadAllText(fileName); return(CsvParser.ParseString(csvString, delimiterType, true)); }