From ec4c098f58c7028d8272097ba1e36e48bbc50172 Mon Sep 17 00:00:00 2001 From: Chuck Cassel Date: Thu, 30 Jun 2016 00:03:13 -0400 Subject: [PATCH 1/2] Add LinesToSkip parameter to CsvFileDescription --- LINQtoCSV/CsvFileDescription.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/LINQtoCSV/CsvFileDescription.cs b/LINQtoCSV/CsvFileDescription.cs index b983ca8..0ea4d46 100644 --- a/LINQtoCSV/CsvFileDescription.cs +++ b/LINQtoCSV/CsvFileDescription.cs @@ -95,6 +95,8 @@ public int MaximumNbrExceptions /// If set to true, wil read only the fields specified as attributes, and will discard other fields in the CSV file /// public bool IgnoreUnknownColumns { get; set; } + + public int LinesToSkip { get; set; } // --------------- @@ -112,6 +114,7 @@ public CsvFileDescription() UseFieldIndexForReadingData = false; UseOutputFormatForParsingCsvValue = false; IgnoreUnknownColumns = false; + LinesToSkip = 0; } } } From 0aec28d610ef82ab6e82fadefce2bd81fbe21393 Mon Sep 17 00:00:00 2001 From: Chuck Cassel Date: Thu, 30 Jun 2016 00:06:03 -0400 Subject: [PATCH 2/2] Implement line skipping in CsvContext --- LINQtoCSV/CsvContext.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/LINQtoCSV/CsvContext.cs b/LINQtoCSV/CsvContext.cs index 62d799c..6aeb690 100644 --- a/LINQtoCSV/CsvContext.cs +++ b/LINQtoCSV/CsvContext.cs @@ -125,6 +125,11 @@ private IEnumerable ReadData( stream.BaseStream.Seek(0, SeekOrigin.Begin); } + + for (int i = 0; i < fileDescription.LinesToSkip; i++) + { + stream.ReadLine(); + } // ----------