473,508 Members | 2,128 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Collection Object

I am using Listdictionary to store key value pair as this doen't sort the key
on it's own. i want the Key value to appear in same sequence as i entered
while retreiving. i can't use the listdictionary as the items i am storing
goes above 10 and which is not recommended for the large collection. i can't
use Hashtable as it sort the collection on the hash code of the key.

i there any collection object which i can use that will give result back the
way i entered in it?
Sep 11 '05 #1
2 1723


Swap wrote:
I am using Listdictionary to store key value pair as this doen't sort the key
on it's own. i want the Key value to appear in same sequence as i entered
while retreiving. i can't use the listdictionary as the items i am storing
goes above 10 and which is not recommended for the large collection. i can't
use Hashtable as it sort the collection on the hash code of the key.
Such a collection is called a linked hashtable. JAVA have such a
data-tructure called java.util.LinkedHashMap.
i there any collection object which i can use that will give result back the
way i entered in it?


Not in System.Collections. You can easily implement one though. If you
never remove items from you dictionary, you can simply maitain a
separate IList of keys which you add to when items are added to your
dictionary.

If you also need to remove items, you can map keys, not into the
user-passed value, but to a double-linked data-structure, like:

class Value {
public Value Next;
public Value Previous;
public Object UserValue;
}

and maintain the links when inserting and removing items.

--
Helge Jensen
mailto:he**********@slog.dk
sip:he**********@slog.dk
-=> Sebastian cover-music: http://ungdomshus.nu <=-
Sep 11 '05 #2
Swap wrote:
I am using Listdictionary to store key value pair as this doen't sort the key
on it's own. i want the Key value to appear in same sequence as i entered
while retreiving. i can't use the listdictionary as the items i am storing
goes above 10 and which is not recommended for the large collection. i can't
use Hashtable as it sort the collection on the hash code of the key.

i there any collection object which i can use that will give result back the
way i entered in it?


Sure. An ArrayList. Or a List<T>.

--

www.midnightbeach.com
Sep 11 '05 #3

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

Similar topics

8
2188
by: Generic Usenet Account | last post by:
To settle the dispute regarding what happens when an "erase" method is invoked on an STL container (i.e. whether the element is merely removed from the container or whether it also gets deleted in...
5
2711
by: Kurt Bauer | last post by:
I have an ASP group calendar application which pulls calendar data from Exchange via webdav into an XML string. I then loop the XML nodes to populate a collection of appointments. Finally I use...
5
1404
by: Kurt Bauer | last post by:
I have an ASP group calendar application which pulls calendar data from Exchange via webdav into an XML string. I then loop the XML nodes to populate a collection of appointments. Finally I use...
10
2749
by: Chet Cromer | last post by:
I am creating a set of base classes and sub classes to use throughout a program I'm developing. The base class represents a generic "lookup table" from my database that contains lists of things...
9
1704
by: bonk | last post by:
Does anyone have a simple example on how to prohibit that any thread other than the current thread modifies a certain object (a collection) while we are in a certain section of the code? In other...
0
7123
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7383
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7046
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7498
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
5627
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,...
1
5053
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...
0
4707
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3194
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3182
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.