If you don't have an instance to search for, you have to do your own search. There are three basic ways to do this:
- Binary search: Implement your own binary search. This will only work if the list is sorted.
- Linear search: Implement your own linear search. This will always work, but on large lists it's significantly slower than a binary search.
- Dictionary lookup: Maintain a
TDictionary
alongside the list. No searching required, though you need to write some code to keep the two in sync.