Exemplo n.º 1
0
        /// <summary>
        /// 从csv文件里面读取对象
        /// </summary>
        /// <typeparam name="T">读取对象的类型</typeparam>
        /// <returns>对象集合的迭代器</returns>
        public IEnumerable <T> ReadObjects <T>() where T : class, new()
        {
            CsvFilePath.ShouldExistSuchFile();
            IsFirstLineHeader.ShouldEqual(true);

            return(ReadObjects <T>(CsvFilePath, Separators, Encoding));
        }
Exemplo n.º 2
0
 /// <summary>
 /// 依次将每行分隔, 返回字符串数组
 /// </summary>
 /// <returns></returns>
 public IEnumerable <string[]> ReadStrings()
 {
     CsvFilePath.ShouldExistSuchFile();
     return(ReadStrings(CsvFilePath, Separators, IsFirstLineHeader, Encoding));
 }
Exemplo n.º 3
0
 /// <summary>
 /// 将每行分隔后, 返回字符串数组和行号
 /// </summary>
 public IEnumerable <(string[] values, int lineNumber)> ReadStringsWithLineNumber()
 {
     CsvFilePath.ShouldExistSuchFile();
     return(ReadStringsWithLineNumber(CsvFilePath, Separators, IsFirstLineHeader, Encoding));
 }
Exemplo n.º 4
0
 /// <summary>
 /// 读取文件标题行
 /// </summary>
 /// <returns>Csv标题</returns>
 public CsvHeader ReadHeader()
 {
     CsvFilePath.ShouldExistSuchFile();
     return(ReadHeader(CsvFilePath, Separators, Encoding));
 }