473,480 Members | 4,827 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Is there a Serializable Sorted List in .NET?

I want to sort a collection of objects, which has been read from an XML
file. I also wish to be able to access the elements of my collection by key
or index.

Is there such a collection already that I can use? I have tried inheriting
from SortedList, but the deserializer gets upset and says that there was an
error deserializing because the collection implements IDictionary.

You probably recognise this question from a while ago, but I haven't found a
satisfactory answer yet.

TIA

Charles
Nov 20 '05 #1
4 4623
Hi Charles:

AFAIK, there's not a native one but if you look at what Les did here
http://www.knowdotnet.com/articles/s...w-listbox.html you can
see it's pretty easy to implement. Implementing Serializable on a class
isn't very complicated and you can use this approach or build on it/change
it with relative ease.

HTH,

Bill
"Charles Law" <bl***@nowhere.com> wrote in message
news:OA**************@TK2MSFTNGP09.phx.gbl...
I want to sort a collection of objects, which has been read from an XML
file. I also wish to be able to access the elements of my collection by key or index.

Is there such a collection already that I can use? I have tried inheriting
from SortedList, but the deserializer gets upset and says that there was an error deserializing because the collection implements IDictionary.

You probably recognise this question from a while ago, but I haven't found a satisfactory answer yet.

TIA

Charles

Nov 20 '05 #2
Hi Charles,

I am waiting on comments on my sample I made for you, it did work form me
completly and I asume that adding someting as the iComparer should not be
that hard.

However you did not give any comments?
(While you promished to do)

Cor
Nov 20 '05 #3
Hi Bill

Following Cor's reminder to me, I have revisited his earlier answer and
found a solution.

Thanks.

Charles
"William Ryan eMVP" <bi**@NoSp4m.devbuzz.com> wrote in message
news:ey**************@TK2MSFTNGP12.phx.gbl...
Hi Charles:

AFAIK, there's not a native one but if you look at what Les did here
http://www.knowdotnet.com/articles/s...w-listbox.html you can
see it's pretty easy to implement. Implementing Serializable on a class
isn't very complicated and you can use this approach or build on it/change it with relative ease.

HTH,

Bill
"Charles Law" <bl***@nowhere.com> wrote in message
news:OA**************@TK2MSFTNGP09.phx.gbl...
I want to sort a collection of objects, which has been read from an XML
file. I also wish to be able to access the elements of my collection by key
or index.

Is there such a collection already that I can use? I have tried inheriting from SortedList, but the deserializer gets upset and says that there was

an
error deserializing because the collection implements IDictionary.

You probably recognise this question from a while ago, but I haven't

found a
satisfactory answer yet.

TIA

Charles


Nov 20 '05 #4
Hi Cor

You are right, and I have now responded in the other thread.

Thanks again (and my apologies).

Charles
"Cor Ligthert" <no**********@planet.nl> wrote in message
news:ul**************@TK2MSFTNGP10.phx.gbl...
Hi Charles,

I am waiting on comments on my sample I made for you, it did work form me
completly and I asume that adding someting as the iComparer should not be
that hard.

However you did not give any comments?
(While you promished to do)

Cor

Nov 20 '05 #5

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

Similar topics

57
3540
by: Egor Bolonev | last post by:
why functions created with lambda forms cannot contain statements? how to get unnamed function with statements?
10
15093
by: Der Andere | last post by:
I need to implement a sorted (ordered) list. STL has no sorted list type as far as I know. Is there a (straight) way to implement a sorted list using STL? BTW: The type of items in the list will...
3
22062
by: Andrew Clark | last post by:
*** post for FREE via your newsreader at post.newsfeed.com *** it's been a while since i have poseted to this newsgroup, but for a long time i was not programming at all. but now that i am out of...
0
1523
by: xmail123 | last post by:
Hi, Hi, As was pointed out whatever you return from a WebMethod needs to be serializable to SOAP. An ArrayList is not serializable. I will be needing to return other data types from web...
8
6274
by: xmail123 | last post by:
Hi, As was pointed out whatever you return from a WebMethod needs to be serializable to SOAP. An ArrayList is not serializable. I will be needing to return other data types from web methods. ...
2
4541
by: Charles Law | last post by:
I have been using the Microsoft.VisualBasic.Collection as the basis of a generic list class because it is the only list class that allows items to be added with and without a key and hence to be...
1
1625
by: J L | last post by:
I want to create a sorted list whose values are themselves sorted lists. I wrote the following simple test program but it does not behave as I would expect. What I wanted to do was have the...
4
1842
by: shrishjain | last post by:
Hi All, I need a type where I can store my items in sorted order. And I want to keep adding items to it, and want it to remain sorted. Is there any type in .net which I can make use of. I see...
4
16888
by: mark4asp | last post by:
I need to add an item to this class which I would like to be public IncumbentManager List<int>; (alternatively it may be an arraylist, but I prefer a List<int>) This is the simplifed code...
0
7040
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
6905
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
7041
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
6908
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
5331
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
4772
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
1299
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
561
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
178
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.