473,414 Members | 1,989 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.

sortedList to viewList is SLOW!

24
Guys,

I have a sortedList, and I want to display it as a table - column one being the sorted list's key, and column 2 being the actual value.

I tried it as follows, using a viewList to display everything:

Expand|Select|Wrap|Line Numbers
  1. foreach (String word in sortedList1.GetKeyList())
  2. {
  3.   String[] entry = new String[] { word, (String)sortedList1[word]};
  4.   viewList1.Items.Add(new ListViewItem(entry));
  5. }
  6.  
But this is slow - it takes minutes to process a few with a couple thousand entires!

Any ideas how i can do this another (FASTER) way!! ;)

thanks
Mar 8 '07 #1
3 1379
Guy007
24
no ideas?! :'(
Mar 9 '07 #2
kenobewan
4,871 Expert 4TB
Maybe try creating an arraylist from the sortedlist and bind to the listview. Probably faster to store data in an object and bind than reading and writing each item.
Mar 13 '07 #3
Guy007
24
i still haven't figured out how to bind the arraylist to the listview!

I tried using a hashtable instead of a sorted list, then iterating through the hashtable and updating the listview accordingly. this gave slightly better performance, but we are still far away from acceptable levels!

How can i do this using multithreading? maybe a threadpool or something?

my code is as follows:

Expand|Select|Wrap|Line Numbers
  1. //populate myHashTable
  2.  
  3. foreach (string key in myHashTable)
  4. {
  5.     String[] entry = new String[] { key, (string)myHashTable[key] };
  6.     myListView.Items.Add(new ListViewItem(entry));
  7. }
  8.  
  9. //continue with other code
How can I introduce multithreading in this part!? Any ideas?

Thanks!
Mar 23 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: gerrod | last post by:
Hi - Does anyone know a way to created a SortedList (in the System.Collections namespace) that will sort on VALUES instead of KEYS... ? The scenario is this - I have a SortedList containing...
6
by: Jose Jarabo | last post by:
Hello, thanks in advance for any and all replies. I am not sure how to categorize this, either a bug or something else but here is my problem. I am testing with 2 elements on a sorted list. If...
2
by: Pekka | last post by:
Could somebody say why the piece of code below does not work? My purpose is to renumber keys in a SortedList (after removal of an item) so that the keys would always contain an unbroken sequence of...
2
by: KrippZ | last post by:
Hello I'm having some problems with a a sortedList in C#. My set is as follows: I have a sortedList as a class variable (DataList) I inisiate it in my constructor with DataList = new SortedList()....
2
by: Prez | last post by:
I started writing .net code yesterday and I am grasping it well enough. I have a few questions about SortedLists. I am using managed C++ if that makes any difference. Of the examples I...
4
by: SHEBERT | last post by:
Here is an example of a SortedList that works as a datasource to the ComboBox and a generic SortedList<that does not works as a datasource to the ComboBox. Why? If I use List and generic List<>,...
4
by: aeshiels | last post by:
Hello, I have a SortedList defined as... SortedList<CUser, CUseruserList = new SortedList<CUser, CUser>(); ....and which to copy it to another sorted list SortedList<CUser,...
1
by: raylopez99 | last post by:
I seem to get name collision between the Generic collection SortedList and C++.NET Framework collection SortedList. How to resolve? Here are the libraries that seem to clash:...
6
by: n3tx | last post by:
Hi! I have a problem with sortedlist, i guess i dont understand how it works. I have a method called GetPublishingPlaces that returns an IList<PublishingPlace> (ex. contains 11 rows) I want...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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
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.