Detailed Method Reference

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

Definition

public List<T> GetRecords(Func<T, bool> pred)
  • Description: Queries the database using a predicate filter to return a list of all records matching the specified criteria.

  • Workflow:

    1. Filtering: Iterates through the internal collection, evaluating each record against the provided lambda expression.
    2. Collection: Gathers all matching record instances into a new list.
  • Parameters:

    • pred: A predicate function defining the conditional query logic (e.g., r => r.value > 10).
  • Returns: List<T> - A list containing all matching record instances, or an empty list if no matches are found.

  • Example:

public void FindEpicItems(CSVTable<ItemRecord> itemTable)
{
    var epicItems = itemTable.GetRecords(i => i.rarity == "Epic");
    Debug.Log(message: $"Found {epicItems.Count} epic items.");
}

TIP

Use GetRecords for complex, query-driven filtering when you need to subset your dataset dynamically based on gameplay stats or attributes.