System 这四个单元多用用(近期)

 参考:https://www.cnblogs.com/xumenger/p/4687493.html

System.Classes.pas:

TList、(TStrings)TStringList

 

System.Contnrs.pas:

TObjectList、

TComponentList、TClassList、TOrderedList、

TStack、TObjectStack、

TQueue、TObjectQueue、

TCustomBucketList

 

System.Generics.Collections.pas:

  TList<T>

  TObjectList<T>

  TDictionary<TKey, TValue>

 

  TStack<T>

  TQueue<T>

 

System.Diagnostics.pas:

procedure TfrmRandomWordSearch.FindGoodWord(const wordTest: TWordCheckDelegate);
var
  word: string;
  isWordOK: boolean;
  time: TStopwatch;
begin
  time := TStopwatch.StartNew;
  repeat
    word := GenerateWord;
    isWordOK := wordTest(word);
  until isWordOK or (time.ElapsedMilliseconds > 10000);
  if isWordOK then
    lbWords.ItemIndex := lbWords.Items.Add(Format('%s (%d ms)', [word, time.ElapsedMilliseconds]))
  else
    lbWords.ItemIndex := lbWords.Items.Add('timeout');
end;

  

posted @ 2018-07-26 12:10  BSor  阅读(173)  评论(0编辑  收藏  举报