我需要在下面的序列中获取哈希表中的输出plz帮助我 [英] i need to get output in hashtable in the below sequence plz help me

查看:46
本文介绍了我需要在下面的序列中获取哈希表中的输出plz帮助我的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

hi,

hi ,

Hashtable ht = new Hashtable();

            ht.Add(1, "std1");
            ht.Add(2, "std2");
            ht.Add(3, "std3");
            ht.Add(4, "std4");



这是我的哈希表。当我检索数据时,输出为4 std4,3 std3,2 std2,1 std1;

但我需要ouput1 std1,2 std2,3 std3,4 std4 ....... thanx


This is my hashtable.when i retrive data the ouput is 4 std4,3 std3,2 std2,1 std1;
but i need ouput1 std1,2 std2,3 std3,4 std4.......thanx

推荐答案

从输出看起来像你想要按排序顺序输出。但不建议对哈希表进行排序。如果您仍想对散列表进行排序,可以通过以下链接:

排序哈希表 [ ^ ]



另一种方式是使用SortedDictionary而不是使用散列表。
From the output it looks like you want the output in sorted order. But sorting a hashtable is not suggested. If you still want to sort the hashtable, you can go through this link:
Sorting Hashtable[^]

The other way is instead of using the hashtable, you can use SortedDictionary.


这篇关于我需要在下面的序列中获取哈希表中的输出plz帮助我的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆