title: How to do for in TObjectList?
body: <p>I am trying to use <code>for in</code> to iterate a <code>TObjectList</code>:</p>
  
  <pre><code>program Project1;
  
  {$APPTYPE CONSOLE}
  
  {$R *.res}
  
  uses
    System.SysUtils, Contnrs;
  
  var
      list: TObjectlist;
      o: TObject;
  begin
      list := TObjectList.Create;
      for o in list do
      begin
          //nothing
      end;
  end.
  </code></pre>
  
  <p>And it fails to compile:</p>
  
  <blockquote>
    <p>[dcc32 Error] Project1.dpr(15): E2010 Incompatible types: 'TObject' and 'Pointer'</p>
  </blockquote>
  
  <p>It seems as though Delphi's <code>for in</code> construct does not handle the untyped, undescended, <code>TObjectList</code> an as enumerable target.</p>
  
  <p>How do i enumerate the objects in a <code>TObjectList</code>?</p>
  
  <h1>What i do now</h1>
  
  <p>My current code is:</p>
  
  <pre><code>procedure TfrmCustomerLocator.OnBatchDataAvailable(BatchList: TObjectList);
  var
     i: Integer;
     o: TObject;
  begin
     for i := 0 to BatchList.Count-1 do
     begin
        o := BatchList.Items[i];
  
        //...snip...where we do something with (o as TCustomer)
     end;
  end;    
  </code></pre>
  
  <p>For no good reason, i was hoping to change it to:</p>
  
  <pre><code>procedure TfrmCustomerLocator.OnBatchDataAvailable(BatchList: TObjectList);
  var
     o: TObject;
  begin
     for o in BatchList do
     begin
        //...snip...where we do something with (o as TCustomer)
     end;
  end;    
  </code></pre>
  
  <p>Why use an enumerator? Just cause.</p>