Populate ListBox Using TDirectory.GetFiles Delphi XE8 -


does more efficient way of populating listbox file names tdirectory.getfiles exist?

procedure poplistbox(var lb: tlistbox; dir, ext: string; so: tsearchoption); var   i: integer;   iend: integer;   oc: tstringdynarray; begin   oc := tdirectory.getfiles(dir, ext, so);   iend := length(oc);   := 0;   repeat     lb.items.add(oc[i]);     inc(i);   until (i > (iend - 1)); end; 

i input community on approach.

it isn't more efficient, can remove couple of variables , few lines of code:

procedure poplistbox(var lb: tlistbox; dir, ext: string; so: tsearchoption); var   oc: tstringdynarray;   s: string; begin   oc := tdirectory.getfiles(dir, ext, so);   lb.items.beginupdate;   try     s in oc       lb.items.add(s);       lb.items.endupdate;   end; end; 

Comments

Popular posts from this blog

1111. appearing after print sequence - php -

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

Ruby on Rails, ActiveRecord, Postgres, UTF-8 and ASCII-8BIT encodings -