public IEnumerable <IDictionary <string, object> > Query(bool useHeaderRow, string sheetName, string startCell) { if (startCell != "A1") { throw new NotImplementedException("CSV not Implement startCell"); } if (_stream.CanSeek) { _stream.Position = 0; } var reader = _config.StreamReaderFunc(_stream); { var row = string.Empty; string[] read; var firstRow = true; Dictionary <int, string> headRows = new Dictionary <int, string>(); while ((row = reader.ReadLine()) != null) { read = Split(row); //header if (useHeaderRow) { if (firstRow) { firstRow = false; for (int i = 0; i <= read.Length - 1; i++) { headRows.Add(i, read[i]); } continue; } var cell = CustomPropertyHelper.GetEmptyExpandoObject(headRows); for (int i = 0; i <= read.Length - 1; i++) { cell[headRows[i]] = read[i]; } yield return(cell); continue; } //body { var cell = CustomPropertyHelper.GetEmptyExpandoObject(read.Length - 1, 0); for (int i = 0; i <= read.Length - 1; i++) { cell[ColumnHelper.GetAlphabetColumnName(i)] = read[i]; } yield return(cell); } } } }