title: Implementing Custom Binary Search for TObjectList<myClass> (Delphi XE)
body: <p>I need to implement a binary search on TObjectList that uses a custom comparer, I believe using TCustomComparer. </p>
  
  <p>Goal:  binary search returns instances in the list that conform to a particular property parameter.</p>
  
  <p>For example:</p>
  
  <pre><code>TMyClass=class
      public
       Index:integer
  end;
  
  TMyObjectList=TObjectList&lt;TMyClass&gt;;
  
  begin
    ...
      aMyClass.Index:=1;
      aMyObjectList.binarysearch(aMyClass, aMyClassRef) 
    ...
  end;
  </code></pre>
  
  <p>Or simply:</p>
  
  <pre><code> begin
     ...
       aMyObjectList.binarysearch(1, aMyClassRef) 
     ...
   end;
  </code></pre>
  
  <p>I want to loop and get back instances of TMyClass in the list that also have Index==1. </p>
  
  <p>In C++, overloading the '==' operator achieves this goal.</p>
  
  <p>The new Delphi 'help' is rather sparse and scattered around making things hard to find, and I'm not that familiar with all the nuances of the new Delphi generics.</p>
  
  <p>So - how do I do it in Delphi XE with the Generics.TObjectList?</p>
  
  <p>(Using Delphi XE).</p>
  
  <p>TIA</p>