Detailed Method Reference

Namespace: Canley.Utility.CSV.Standard
Class: CSVRecord

Definition

public void Initialize(string[] columns, Dictionary<string, int> headerMap)
  • Description: Initialises the record instance by mapping parsed CSV column values against the header index dictionary.

  • Workflow:

    1. Data Binding: Iterates through the header mapping to populate strongly-typed properties and the underlying shadow dictionary.
    2. Fallback Generation: Generates or assigns the fallback id and recordLabel if explicit values are missing.
  • Parameters:

    • columns: An array of raw string values representing a single parsed CSV row.
    • headerMap: A dictionary mapping column header names to their corresponding array indices.
  • Returns: void

  • Example:

public void SetupNewRecord(CSVRecord record, string[] rowData, Dictionary<string, int> headers)
{
    record.Initialize(rowData, headers);
    Debug.Log(message: $"Successfully initialised record: {record.recordLabel}");
}

TIP

This method is typically handled automatically behind the scenes by CSVTable<T> during table loading, so you rarely need to call it manually unless you are instantiating records programmatically.