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版ip地址与整型互转

Delphi firedac 连接sql server一些要注意的地方

阻止删除文件(文件占坑)的Delphi代码

Delphi datasnap清除僵死连接

Delphi 控制n个字符间距空格

Delphi 无法结束进程的程序

Delphi api 函数中使用 pchar 参数的几种方法

Delphi获取默认浏览器

Delphi richedit文字背景色的处理

Delphi stringgrid 加载excel表格文件内容自动宽度

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



打赏

取消

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

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

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

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

评论

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