Skip to content

Find an item through IBindingList

This operation is clsBindableCollectionBase's explicit IBindingList.Find(...) implementation. Rather than searching the collection itself, it forwards every request to the protected IBindingList_Find(...) extension point, so the actual search algorithm is entirely the subclass's responsibility.

Field Value
Operation ID OP-BIND-004
Trigger Caller invokes IBindingList.Find(PropertyDescriptor property, object key).
Inputs PropertyDescriptor property, object key.
Outputs Integer index from IBindingList_Find(...); the unoverridden base hook always returns -1.
Primary components clsBindableCollectionBase.IBindingList.Find, clsBindableCollectionBase.IBindingList_Find
Entry point SAIF.Framework.Bindable\clsBindableCollectionBase.cs

Steps

  1. A caller invokes the explicit IBindingList.Find(...) implementation, supplying the property to search on and the key value to match.
  2. The method forwards both arguments unchanged to the protected virtual IBindingList_Find(property, key) hook.
  3. The hook returns an integer index — its meaning depends entirely on whether a subclass has overridden it.
  4. The method returns that integer result to the caller without further interpretation.
  5. In the base class, the default IBindingList_Find(...) implementation simply returns -1, so an unoverridden collection reports every search as a non-match.

Process flow

The following diagram visualizes this operation's control flow.

flowchart TD
    Start([Caller invokes IBindingList.Find]) --> Delegate[Call IBindingList_Find(property, key)]
    Delegate --> Result{Returned index}
    Result -->|>= 0| Found([Return matching index])
    Result -->|-1| NotFound([Return not found indicator])

Failure and edge-case behavior

  • Base implementation only: the operation returns -1 for every call, so no match is ever reported unless a subclass overrides IBindingList_Find(...) with real lookup logic.
  • The method does not check AllowFind before forwarding: a direct caller can still invoke Find(...) even when SupportsSearching reports false, and will simply receive whatever the hook returns.

Sources

  • SAIF.Framework.Bindable\clsBindableCollectionBase.cs