473,414 Members | 1,709 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,414 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 1722


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...
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
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
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
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,...
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...
0
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...

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.