TROCollection

Overview

The TROCollection class is a specialization of the TCollection class which utilizes Delphi's RTTI to work with the published properties of the items in the collection.

Location


Instance Methods


GetIndex

Searches for an item with a aPropertyName property, which is accessible via GetPropValue and is equal to aPropertyValue. Returns the index of the first item found or -1.

function GetIndex(const aPropertyName: string; const aPropertyValue: Variant; StartFrom: Integer; Options: TROSearchOptions): Integer

Parameters:

  • aPropertyName: Name of the published property
  • aPropertyValue: Value of the property
  • StartFrom: Item index to start from
  • Options: Value of TROSearchOptions

Handy wrapper for GetIndex, which returns the found item or NIL.

function Search(const aPropertyName: string; const aPropertyValue: Variant; StartFrom: Integer; Options: TROSearchOptions): TCollectionItem

Parameters:

  • aPropertyName: property name
  • aPropertyValue: property value
  • StartFrom: index
  • Options: options