473,397 Members | 2,068 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

How to SOrt a HashTable In C#

RSB
How do i sort a Hash Table..
Thanks
RSB
Nov 18 '05 #1
2 6035
By it's definition, a hashtable is not a sorted collection. Perhaps you
should use another collection type.

"RSB" <rs*****@hotmail.com> wrote in message
news:Ju*****************@news.cpqcorp.net...
How do i sort a Hash Table..
Thanks
RSB

Nov 18 '05 #2
"RSB" <rs*****@hotmail.com> wrote in message
news:Ju*****************@news.cpqcorp.net...
How do i sort a Hash Table..


You could add the HashTable to an empty ArrayList, then sort the ArrayList:

public ICollection SortedHashTable(HashTable ht)
{
ArrayList sorter = new ArrayList();
sorter.AddRange(ht);
sorter.Sort();
return sorter;
}
--
John Saunders
johnwsaundersiii at hotmail
Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Mark | last post by:
I'm using an enumerator to iterate through a HashTable that contains all numeric keys. I'd like to iterarate through the HashTable based on the ordered keys. Is there a quick way to do this?...
5
by: Arjen | last post by:
Hello, Let's say that we have a hashtable with some person objects. This persons have a name. Now I want to sort the people objects inside the hashtable by name. How can the hashtable do this...
9
by: Arjen | last post by:
Hello, Persons is a hashtable which I convert to an array. Person aPerson = new Person; Persons.Values.CopyTo( aPerson, 0 ); Now I can access the person items like aPerson.name or...
3
by: Alexander Widera | last post by:
Hi, I have a problem with this code ... (see below) ... I want to sort an instance of MyList ... by MyData.Shortname ... Shortname is of the type string.... how can I sort the entries? Thank...
2
by: Ali | last post by:
I am binding a hashTable to a dropDownList to pick a State (key: like New York) and sends the state designation (value: NY) to a filtering procedure. I have entered the states in the hashTable in...
3
by: Jim Adams | last post by:
I'm counting the frequency of word occurances and would like to return a key/value list sorted descending by frequency. So I need to quickly see if a word (key) is in the list, but later sort...
6
by: max sharma | last post by:
Hi all, I am using a hashtable for my application. Its similar to word count application. How can I sort the hashtable w.r.t. the VALUE and not the KEY. The sample data of the table is given below...
11
by: Cappamontana | last post by:
Hi, I'm stuck with a problem...in .Net C# I want to sort an ArrayList containing Hashtables. The sort key must be the key of the Hashtable. How can I do this? I've coded some example here... ...
1
by: Pedro Rosas Silva | last post by:
Hi all, I have a datagrid in an ASP.Net 1.1 web application which is binded to an HashTable. The grid has several columns and I want to sort the results by one of those columns. Are you aware...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.