473,396 Members | 2,089 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,396 software developers and data experts.

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 1720


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
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
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
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
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
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
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...
0
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
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,...

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.