Detailed Method Reference
Namespace: Canley.Utility.CSV
Class: CanleyCSVReader
GetColumnCount
public int GetColumnCount(int rowIndex)-
Description: Returns the number of columns found in a specific row. This is useful for iterating through “jagged” CSVs or verifying row lengths manually.
-
Workflow:
- Index Validation: Checks if the provided
rowIndexexists within the current data grid. - Length Assessment: If valid, retrieves the length of the string array at that specific index.
- Error Handling: Returns 0 if the index is out of range.
- Index Validation: Checks if the provided
-
Parameters:
rowIndex: The zero-based index of the row to inspect.
-
Returns:
int(Column count, or 0 if the row index is invalid). -
Example:
int colsInHeader = reader.GetColumnCount(0);