3edadec5 3bf2 cb47 623a be284393dd8c - akesseler/Plexdata.CsvParser GitHub Wiki
This method validates the number of columns of each line.
Namespace: Plexdata.CsvParser.Processors
Assembly: Plexdata.CsvParser.NET (in Plexdata.CsvParser.NET.dll) Version: 1.1.3+d5bef99aa35461ce4bafadf0bf2c2aeca18044ea
C#
private static void ValidateColumns(
List<string> lines,
char separator,
bool exactly,
List<ItemDescriptor> items
)
- lines
- Type: System.Collections.Generic.List(String)
The list of lines to be validated. - separator
- Type: System.Char
The separator to split each line into its parts. - exactly
- Type: System.Boolean
The column count must match exactly, if true. Otherwise, the column count must be at least the minimum of expected columns. - items
- Type: System.Collections.Generic.List(ItemDescriptor)
The list of descriptors representing a single line.
Exception | Condition |
---|---|
FormatException | This exceptions is thrown as soon as one of lines does not fit the expected column count according the applied rules. |
Each line contains at least the expected number of columns if this method passes through without throwing an exception. How the validation is performed in details depends on the state of parameter exactly. If exactly is true and one of the line does not exactly contain the number of expected columns, then an exception is thrown. If exactly is false then each line must contain at least the number of expected columns. Overhanging columns are ignored in such a case.
CsvImporter(TInstance) Class
Plexdata.CsvParser.Processors Namespace