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:

    1. Index Validation: Checks if the provided rowIndex exists within the current data grid.
    2. Length Assessment: If valid, retrieves the length of the string array at that specific index.
    3. Error Handling: Returns 0 if the index is out of range.
  • 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);