Delphi TDictionary 泛型如何排序


本文整理自网络,侵删。

 
uses Generics.Collections; {Delphi 2009 新增的泛型容器单元}

var
  aa: TDictionary<integer,integer>;
  arr : TArray<Integer>;
  n : integer;
begin
  aa := TDictionary<integer,integer>.Create;
  try
    aa.add(1,11);
    aa.add(2,22);
    aa.add(3,33);

    arr := aa.Keys.ToArray;
    TArray.Sort<Integer>(arr);

    for n in arr do
      ShowMessage(IntToStr(aa[n]));
  finally
    aa.Free;
  end;

相关阅读 >>

Delphi 输出用空格对齐字符串的函数

Delphi中组件panel、splitter、groupbox、按钮组件(checkbox...)、计时器、滚动条、多选卡

Delphi窗口界面必学的知识

sqlite中的pragma语句攻略

Delphi 日期加减

Delphi twebbrowser 屏蔽右键菜单

Delphi rgb 画出三角形

Delphi 将 html 代码直接加入到 twebbrowser 组件中去

Delphi程序在每个windows 会话中只执行一次

Delphi 删除动态数组的指定元素

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...