Detailed Method Reference

Namespace: Canley.Utility.CSV.Standard
Class: CSVTable<T>

Definition

public T GetRecord(string label)
  • Description: Performs a case-insensitive lookup to locate and return a specific record instance matching the provided string label or slug.

  • Workflow:

    1. Slug Resolution: Queries the internal string-to-record lookup dictionary using a case-insensitive comparison.
    2. Retrieval: Returns the matching strongly-typed record instance, or null if no record matches the given label.
  • Parameters:

    • label: The string label or key identifying the record.
  • Returns: T - The matching record instance, or null if not found.

  • Example:

public void FindWeaponByLabel(CSVTable<WeaponRecord> weaponTable)
{
    WeaponRecord record = weaponTable.GetRecord("Steel_Sword");
    if (record != null)
    {
        Debug.Log(message: $"Found weapon damage: {record.damage}");
    }
}

TIP

This method is ideal for designer-facing systems where referencing rows by name tags or string identifiers is more intuitive than using raw integer hashes.